You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sling.apache.org by dk...@apache.org on 2019/10/04 19:14:45 UTC

[sling-org-apache-sling-app-cms] branch master updated: Fixed SLING-8762: Added an archetype for a Sling CMS project

This is an automated email from the ASF dual-hosted git repository.

dklco pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-app-cms.git


The following commit(s) were added to refs/heads/master by this push:
     new 467816f  Fixed SLING-8762: Added an archetype for a Sling CMS project
     new c2846a2  Merge branch 'master' of github.com:apache/sling-org-apache-sling-app-cms
467816f is described below

commit 467816fc4b19aaa5e418b731efc5efc53895e2c8
Author: Dan Klco <dk...@apache.org>
AuthorDate: Fri Oct 4 15:11:43 2019 -0400

    Fixed SLING-8762: Added an archetype for a Sling CMS project
---
 archetype/pom.xml                                  |  45 ++++
 .../META-INF/maven/archetype-metadata.xml          |  40 ++++
 .../main/resources/archetype-resources/README.md   |  25 ++
 .../main/resources/archetype-resources/gulpfile.js |  24 ++
 .../resources/archetype-resources/package.json     |  12 +
 .../src/main/resources/archetype-resources/pom.xml | 261 +++++++++++++++++++++
 .../src/main/java/__package__/HelloWorldModel.java |  31 +++
 .../jcr_root/apps/__appName__/components/page.json |   6 +
 .../apps/__appName__/components/page/body.jsp      |  28 +++
 .../apps/__appName__/components/page/head.jsp      |  25 ++
 .../main/resources/jcr_root/conf/__appName__.json  | 179 ++++++++++++++
 .../test/java/__package__/HelloWorldModelTest.java |  45 ++++
 .../src/test/resources/resource.json               |   3 +
 pom.xml                                            |   9 +-
 14 files changed, 729 insertions(+), 4 deletions(-)

diff --git a/archetype/pom.xml b/archetype/pom.xml
new file mode 100644
index 0000000..24d1d02
--- /dev/null
+++ b/archetype/pom.xml
@@ -0,0 +1,45 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<!-- Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to you under
+the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in
+writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the
+License. -->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+  <modelVersion>4.0.0</modelVersion>
+  <parent>
+    <artifactId>org.apache.sling.cms</artifactId>
+    <groupId>org.apache.sling</groupId>
+    <version>0.12.1-SNAPSHOT</version>
+  </parent>
+  <artifactId>org.apache.sling.cms.archetype</artifactId>
+  <packaging>maven-archetype</packaging>
+  <name>Apache Sling - CMS Archetype</name>
+  <description>A Maven Archetype for creating Sling CMS projects</description>
+
+  <build>
+    <resources>
+      <resource>
+        <directory>src/main/resources</directory>
+        <filtering>true</filtering>
+        <includes>
+          <include>META-INF/maven/archetype-metadata.xml</include>
+        </includes>
+      </resource>
+      <resource>
+        <directory>src/main/resources</directory>
+        <filtering>false</filtering>
+        <excludes>
+          <exclude>META-INF/maven/archetype-metadata.xml</exclude>
+        </excludes>
+      </resource>
+    </resources>
+
+    <extensions>
+      <extension>
+        <groupId>org.apache.maven.archetype</groupId>
+        <artifactId>archetype-packaging</artifactId>
+        <version>3.1.1</version>
+      </extension>
+    </extensions>
+  </build>
+
+</project>
diff --git a/archetype/src/main/resources/META-INF/maven/archetype-metadata.xml b/archetype/src/main/resources/META-INF/maven/archetype-metadata.xml
new file mode 100644
index 0000000..6aa62f0
--- /dev/null
+++ b/archetype/src/main/resources/META-INF/maven/archetype-metadata.xml
@@ -0,0 +1,40 @@
+<!-- Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to you under
+the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in
+writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the
+License. -->
+<archetype-descriptor
+  xsi:schemaLocation="http://maven.apache.org/plugins/maven-archetype-plugin/archetype-descriptor/1.0.0
+        http://maven.apache.org/xsd/archetype-descriptor-1.0.0.xsd"
+  xmlns="http://maven.apache.org/plugins/maven-archetype-plugin/archetype-descriptor/1.0.0"
+  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+  name="quickstart">
+  <requiredProperties>
+    <requiredProperty key="appName"/>
+    <requiredProperty key="package"/>
+    <requiredProperty key="slingcmsVersion">
+      <defaultValue>${project.version}</defaultValue>
+    </requiredProperty>
+  </requiredProperties>
+  <fileSets>
+    <fileSet filtered="true">
+      <directory></directory>
+      <includes>
+        <include>package.json</include>
+        <include>gulpfile.js</include>
+        <include>README.md</include>
+      </includes>
+    </fileSet>
+    <fileSet filtered="true">
+      <directory>src/main/java</directory>
+    </fileSet>
+    <fileSet filtered="true">
+      <directory>src/main/resources</directory>
+    </fileSet>
+    <fileSet filtered="true">
+      <directory>src/test/java</directory>
+    </fileSet>
+    <fileSet filtered="true">
+      <directory>src/test/resources</directory>
+    </fileSet>
+  </fileSets>
+</archetype-descriptor>
diff --git a/archetype/src/main/resources/archetype-resources/README.md b/archetype/src/main/resources/archetype-resources/README.md
new file mode 100644
index 0000000..fbe66ce
--- /dev/null
+++ b/archetype/src/main/resources/archetype-resources/README.md
@@ -0,0 +1,25 @@
+<!-- Licensed to the Apache Software Foundation (ASF) under one or more contributor
+	license agreements. See the NOTICE file distributed with this work for additional
+	information regarding copyright ownership. The ASF licenses this file to
+	you under the Apache License, Version 2.0 (the "License"); you may not use
+	this file except in compliance with the License. You may obtain a copy of
+	the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required
+	by applicable law or agreed to in writing, software distributed under the
+	License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS
+	OF ANY KIND, either express or implied. See the License for the specific
+	language governing permissions and limitations under the License. -->
+# ${appname} Sling CMS Project
+
+An OSGi Bundle project created for the Apache Sling CMS. This project includes a
+ simple client library using Bootstrap, a site configuration, a simple app with
+ a page template and a HelloWorld Sling Model.
+
+## Building
+
+This project requires Apache Maven 3 and Java JDK8. To build the project run:
+
+`mvn clean install`
+
+To install the bundle into a local Sling CMS instance running on port 8080, run:
+
+`mvn clean install -P autoInstallBundle`
diff --git a/archetype/src/main/resources/archetype-resources/gulpfile.js b/archetype/src/main/resources/archetype-resources/gulpfile.js
new file mode 100644
index 0000000..40952bb
--- /dev/null
+++ b/archetype/src/main/resources/archetype-resources/gulpfile.js
@@ -0,0 +1,24 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+var gulp = require('gulp');
+
+gulp.task('css', function() {
+  return gulp.src(['./node_modules/bootstrap/dist/css/bootstrap.min.css'])
+    .pipe(gulp.dest('./target/dist/jcr_root/static/clientlibs/${appName}/css'));
+});
+
+gulp.task('default', gulp.series('css'));
diff --git a/archetype/src/main/resources/archetype-resources/package.json b/archetype/src/main/resources/archetype-resources/package.json
new file mode 100644
index 0000000..fdde400
--- /dev/null
+++ b/archetype/src/main/resources/archetype-resources/package.json
@@ -0,0 +1,12 @@
+{
+    "name": "${appName}-front-end",
+    "version": "1.0.0",
+    "description": "Scripts and Styles for ${appName}",
+    "dependencies": {
+        "bootstrap": "^4.3.1"
+    },
+    "devDependencies": {
+        "gulp": "^4.0.1"
+    },
+    "license": "Apache-2.0"
+}
diff --git a/archetype/src/main/resources/archetype-resources/pom.xml b/archetype/src/main/resources/archetype-resources/pom.xml
new file mode 100644
index 0000000..91d1ee4
--- /dev/null
+++ b/archetype/src/main/resources/archetype-resources/pom.xml
@@ -0,0 +1,261 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<!-- Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to you under
+the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in
+writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the
+License. -->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+  <modelVersion>4.0.0</modelVersion>
+  <groupId>${groupId}</groupId>
+  <artifactId>${artifactId}</artifactId>
+  <version>${version}</version>
+  <packaging>bundle</packaging>
+  <name>${appName}</name>
+  <description>${appName} Sling CMS Project</description>
+
+  <properties>
+    <!-- Use UTF-8 -->
+    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+
+    <!-- Java Compiler Version -->
+    <maven.compiler.target>1.8</maven.compiler.target>
+    <maven.compiler.source>1.8</maven.compiler.source>
+
+    <!-- Install Parameters -->
+    <sling.protocol>http</sling.protocol>
+    <sling.host>localhost</sling.host>
+    <sling.port>8080</sling.port>
+    <sling.username>admin</sling.username>
+    <sling.password>admin</sling.password>
+  </properties>
+
+  <build>
+    <plugins>
+
+      <!-- Handle the NodeJS Build -->
+      <plugin>
+        <groupId>com.github.eirslett</groupId>
+        <artifactId>frontend-maven-plugin</artifactId>
+        <version>1.7.6</version>
+        <executions>
+          <execution>
+            <id>install node and npm</id>
+            <goals>
+              <goal>install-node-and-npm</goal>
+            </goals>
+            <configuration>
+              <nodeVersion>v11.14.0</nodeVersion>
+              <npmVersion>6.9.0</npmVersion>
+            </configuration>
+          </execution>
+          <execution>
+            <id>npm install</id>
+            <goals>
+              <goal>npm</goal>
+            </goals>
+            <configuration>
+              <arguments>install</arguments>
+            </configuration>
+          </execution>
+          <execution>
+            <id>gulp build</id>
+            <goals>
+              <goal>gulp</goal>
+            </goals>
+          </execution>
+        </executions>
+      </plugin>
+
+      <!-- Build the bundle -->
+      <plugin>
+        <groupId>org.apache.felix</groupId>
+        <artifactId>maven-bundle-plugin</artifactId>
+        <version>4.2.1</version>
+        <extensions>true</extensions>
+        <configuration>
+          <instructions>
+            <Sling-Initial-Content>
+              jcr_root,
+              jcr_root/apps/${appName};overwrite:=true;uninstall:=true;path:=/apps/${appName},
+              jcr_root/conf/${appName};overwrite:=false;uninstall:=false;path:=/conf/${appName},
+              jcr_root/static/clientlibs/${appName};overwrite=true;ignoreImportProviders:=xml;path:=/static/clientlibs/${appName}
+            </Sling-Initial-Content>
+            <Sling-Model-Packages>
+                ${package}
+            </Sling-Model-Packages>
+            <Include-Resource>{maven-resources},${basedir}/target/dist</Include-Resource>
+          </instructions>
+        </configuration>
+      </plugin>
+    </plugins>
+  </build>
+
+  <dependencies>
+
+    <dependency>
+      <groupId>javax.jcr</groupId>
+      <artifactId>jcr</artifactId>
+      <version>2.0</version>
+      <scope>provided</scope>
+    </dependency>
+    <dependency>
+      <groupId>javax.servlet</groupId>
+      <artifactId>jsp-api</artifactId>
+      <version>2.0</version>
+      <scope>provided</scope>
+    </dependency>
+    <dependency>
+      <groupId>javax.servlet</groupId>
+      <artifactId>javax.servlet-api</artifactId>
+      <version>3.1.0</version>
+      <scope>provided</scope>
+    </dependency>
+    <dependency>
+      <groupId>jstl</groupId>
+      <artifactId>jstl</artifactId>
+      <version>1.2</version>
+      <scope>provided</scope>
+    </dependency>
+
+    <dependency>
+      <groupId>javax.servlet</groupId>
+      <artifactId>servlet-api</artifactId>
+      <version>2.5</version>
+      <scope>provided</scope>
+    </dependency>
+
+    <dependency>
+      <groupId>org.apache.commons</groupId>
+      <artifactId>commons-lang3</artifactId>
+      <version>3.4</version>
+      <scope>provided</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.geronimo.specs</groupId>
+      <artifactId>geronimo-atinject_1.0_spec</artifactId>
+      <version>1.0</version>
+      <scope>provided</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.jackrabbit</groupId>
+      <artifactId>jackrabbit-jcr-commons</artifactId>
+      <version>2.7.5</version>
+      <scope>provided</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.sling</groupId>
+      <artifactId>org.apache.sling.api</artifactId>
+      <version>2.18.0</version>
+      <scope>provided</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.sling</groupId>
+      <artifactId>org.apache.sling.cms.api</artifactId>
+      <version>${slingcmsVersion}</version>
+      <scope>provided</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.sling</groupId>
+      <artifactId>org.apache.sling.models.api</artifactId>
+      <version>1.3.6</version>
+      <scope>provided</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.sling</groupId>
+      <artifactId>org.apache.sling.scripting.api</artifactId>
+      <version>2.2.0</version>
+      <scope>provided</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.sling</groupId>
+      <artifactId>org.apache.sling.scripting.jsp.taglib</artifactId>
+      <version>2.3.0</version>
+      <scope>provided</scope>
+    </dependency>
+
+    <dependency>
+      <groupId>org.osgi</groupId>
+      <artifactId>org.osgi.service.component.annotations</artifactId>
+      <version>1.4.0</version>
+      <scope>provided</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.osgi</groupId>
+      <artifactId>org.osgi.service.metatype.annotations</artifactId>
+      <version>1.4.0</version>
+      <scope>provided</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.osgi</groupId>
+      <artifactId>osgi.annotation</artifactId>
+      <version>6.0.1</version>
+      <scope>provided</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.osgi</groupId>
+      <artifactId>osgi.core</artifactId>
+      <version>6.0.0</version>
+      <scope>provided</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.osgi</groupId>
+      <artifactId>osgi.cmpn</artifactId>
+      <version>6.0.0</version>
+      <scope>provided</scope>
+    </dependency>
+
+    <dependency>
+      <groupId>org.slf4j</groupId>
+      <artifactId>slf4j-api</artifactId>
+      <version>1.7.25</version>
+      <scope>provided</scope>
+    </dependency>
+
+    <!-- Testing dependencies -->
+    <dependency>
+      <groupId>junit</groupId>
+      <artifactId>junit</artifactId>
+      <version>4.12</version>
+      <scope>provided</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.sling</groupId>
+      <artifactId>org.apache.sling.testing.sling-mock.junit4</artifactId>
+      <version>2.3.0</version>
+      <scope>provided</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.mockito</groupId>
+      <artifactId>mockito-core</artifactId>
+      <version>2.27.0</version>
+      <scope>provided</scope>
+    </dependency>
+  </dependencies>
+
+  <profiles>
+    <profile>
+      <id>autoInstallBundle</id>
+      <build>
+        <plugins>
+          <plugin>
+            <groupId>org.apache.sling</groupId>
+            <artifactId>maven-sling-plugin</artifactId>
+            <version>2.4.2</version>
+            <executions>
+              <execution>
+                <id>install-bundle</id>
+                <goals>
+                  <goal>install</goal>
+                </goals>
+                <configuration>
+                  <slingUrl>${sling.protocol}://${sling.host}:${sling.port}/system/console</slingUrl>
+                  <user>${sling.username}</user>
+                  <password>${sling.password}</password>
+                </configuration>
+              </execution>
+            </executions>
+          </plugin>
+        </plugins>
+      </build>
+    </profile>
+  </profiles>
+</project>
diff --git a/archetype/src/main/resources/archetype-resources/src/main/java/__package__/HelloWorldModel.java b/archetype/src/main/resources/archetype-resources/src/main/java/__package__/HelloWorldModel.java
new file mode 100644
index 0000000..933a9fc
--- /dev/null
+++ b/archetype/src/main/resources/archetype-resources/src/main/java/__package__/HelloWorldModel.java
@@ -0,0 +1,31 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package ${package};
+
+import org.apache.sling.api.resource.Resource;
+import org.apache.sling.models.annotations.Model;
+
+/**
+ * Service for greeting the world
+ */
+@Model(adaptables={Resource.class})
+public class HelloWorldModel {
+
+	public String getMessage(){
+    return "Hello World!";
+  }
+}
diff --git a/archetype/src/main/resources/archetype-resources/src/main/resources/jcr_root/apps/__appName__/components/page.json b/archetype/src/main/resources/archetype-resources/src/main/resources/jcr_root/apps/__appName__/components/page.json
new file mode 100644
index 0000000..91db14b
--- /dev/null
+++ b/archetype/src/main/resources/archetype-resources/src/main/resources/jcr_root/apps/__appName__/components/page.json
@@ -0,0 +1,6 @@
+{
+    "jcr:primaryType" : "sling:Component",
+    "jcr:title": "${sample} - Page",
+    "sling:resourceSuperType": "reference/components/pages/base",
+    "componentType": "Page"
+}
diff --git a/archetype/src/main/resources/archetype-resources/src/main/resources/jcr_root/apps/__appName__/components/page/body.jsp b/archetype/src/main/resources/archetype-resources/src/main/resources/jcr_root/apps/__appName__/components/page/body.jsp
new file mode 100644
index 0000000..8fa1e29
--- /dev/null
+++ b/archetype/src/main/resources/archetype-resources/src/main/resources/jcr_root/apps/__appName__/components/page/body.jsp
@@ -0,0 +1,28 @@
+<%-- /*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */ --%>
+ <%@include file="/libs/sling-cms/global.jsp"%>
+<body>
+  <sling:call script="/libs/sling-cms/components/editor/scripts/init.jsp" />
+  <main role="main" class="container">
+    <sling:adaptTo adaptable="${resource}" adaptTo="${package}.HelloWorldModel" var="helloWorld" />
+    <sling:encode value="${helloWorld.message}" mode="HTML" />
+    <sling:include path="container" resourceType="sling-cms/components/general/container"/>
+  </main>
+  <sling:call script="/libs/sling-cms/components/editor/scripts/finalize.jsp" />
+</body>
diff --git a/archetype/src/main/resources/archetype-resources/src/main/resources/jcr_root/apps/__appName__/components/page/head.jsp b/archetype/src/main/resources/archetype-resources/src/main/resources/jcr_root/apps/__appName__/components/page/head.jsp
new file mode 100644
index 0000000..d91043b
--- /dev/null
+++ b/archetype/src/main/resources/archetype-resources/src/main/resources/jcr_root/apps/__appName__/components/page/head.jsp
@@ -0,0 +1,25 @@
+<%-- /*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */ --%>
+ <%@include file="/libs/sling-cms/global.jsp"%>
+<head>
+  <meta charset="utf-8">
+  <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no" />
+  <title>${resource.valueMap['jcr:title']} | ${appName}</title>
+  <link href="/static/clientlibs/${appName}/css/bootstrap.min.css" rel="stylesheet">
+</head>
diff --git a/archetype/src/main/resources/archetype-resources/src/main/resources/jcr_root/conf/__appName__.json b/archetype/src/main/resources/archetype-resources/src/main/resources/jcr_root/conf/__appName__.json
new file mode 100644
index 0000000..df6bb0f
--- /dev/null
+++ b/archetype/src/main/resources/archetype-resources/src/main/resources/jcr_root/conf/__appName__.json
@@ -0,0 +1,179 @@
+{
+    "jcr:primaryType": "sling:OrderedFolder",
+    "jcr:content": {
+        "jcr:primaryType": "nt:unstructured",
+        "jcr:title": "${appName}"
+    },
+    "site": {
+        "jcr:primaryType": "sling:OrderedFolder",
+        "jcr:content": {
+            "jcr:primaryType": "nt:unstructured",
+            "jcr:title": "Default Site Configuration"
+        },
+        "rewrite": {
+            "jcr:primaryType": "sling:Config",
+            "jcr:title": "Rewriter",
+            "sling:resourceType": "sling-cms/components/caconfig/rewriter",
+            "doctype": "<!DOCTYPE html>",
+            "attributes": [
+                "action",
+                "href",
+                "src"
+            ]
+        },
+        "policies": {
+            "jcr:primaryType": "sling:Config",
+            "jcr:title": "${appName} Default Policy",
+            "sling:resourceType": "sling-cms/components/caconfig/policies",
+            "policy": {
+                "jcr:primaryType": "nt:unstructured",
+                "jcr:title": "Bootstrap CSS Policy",
+                "availableComponentTypes": [
+                    "General"
+                ],
+                "sling:resourceType": "sling-cms/components/caconfig/policy",
+                "componentConfigurations": {
+                    "jcr:primaryType": "nt:unstructured",
+                    "form": {
+                        "jcr:primaryType": "nt:unstructured",
+                        "fieldConfigGroups": "Form Field,General",
+                        "checkInputClass": "form-check-input",
+                        "fieldGroupClass": "form-group",
+                        "checkLabelClass": "form-check-label",
+                        "fieldRequiredClass": "text-danger",
+                        "type": "reference/components/forms/form",
+                        "submitClass": "btn btn-primary",
+                        "fieldClass": "form-control",
+                        "actionConfigGroups": "Form Action",
+                        "providerConfigGroups": "Form Value Provider",
+                        "sling:resourceType": "sling-cms/components/caconfig/component",
+                        "checkFieldClass": "form-check",
+                        "formClass": "form",
+                        "alertClass": "alert alert-dark"
+                    },
+                    "cta": {
+                        "jcr:primaryType": "nt:unstructured",
+                        "ctaClasses": [
+                            "Primary=btn btn-primary"
+                        ],
+                        "type": "reference/components/general/cta",
+                        "sling:resourceType": "sling-cms/components/caconfig/component"
+                    },
+                    "container": {
+                        "jcr:primaryType": "nt:unstructured",
+                        "type": "reference/components/general/columncontrol",
+                        "containerclass": "container",
+                        "columns": [
+                            "100%=col-md-12",
+                            "50% 50%=col-6,col-6",
+                            "33% 33% 33%=col-4,col-4,col-4"
+                        ],
+                        "sling:resourceType": "sling-cms/components/caconfig/component"
+                    },
+                    "frame": {
+                        "jcr:primaryType": "nt:unstructured",
+                        "iframeClass": "frame",
+                        "type": "reference/components/general/iframe",
+                        "sling:resourceType": "sling-cms/components/caconfig/component",
+                        "wrapperClasses": [
+                            "Embed Responsive=embed-responsive"
+                        ]
+                    },
+                    "image": {
+                        "jcr:primaryType": "nt:unstructured",
+                        "type": "reference/components/general/image",
+                        "sling:resourceType": "sling-cms/components/caconfig/component",
+                        "imageClasses": [
+                            "Responsive=img-responsive"
+                        ]
+                    },
+                    "list": {
+                        "jcr:primaryType": "nt:unstructured",
+                        "pageItemClass": "page-item",
+                        "pageLinkClass": "page-link",
+                        "type": "reference/components/general/list",
+                        "paginationClass": "pagination",
+                        "sling:resourceType": "sling-cms/components/caconfig/component"
+                    },
+                    "search": {
+                        "jcr:primaryType": "nt:unstructured",
+                        "pageItemClass": "page-item",
+                        "pageLinkClass": "page-link",
+                        "searchClass": "search",
+                        "resultClass": "search-result",
+                        "type": "reference/components/general/search",
+                        "paginationClass": "pagination",
+                        "resultHeaderClass": "search-header",
+                        "sling:resourceType": "sling-cms/components/caconfig/component"
+                    },
+                    "searchform": {
+                        "jcr:primaryType": "nt:unstructured",
+                        "buttonClass": "btn btn-primary",
+                        "type": "reference/components/general/searchform",
+                        "sling:resourceType": "sling-cms/components/caconfig/component",
+                        "inputClass": "input",
+                        "formClass": "form"
+                    },
+                    "tags": {
+                        "jcr:primaryType": "nt:unstructured",
+                        "tagPage": "",
+                        "listClass": "tag-list",
+                        "type": "reference/components/general/tags",
+                        "listTag": "div",
+                        "sling:resourceType": "sling-cms/components/caconfig/component",
+                        "itemTag": "div",
+                        "itemClass": "tag-item"
+                    }
+                }
+            }
+        },
+        "settings": {
+            "jcr:primaryType": "sling:Config",
+            "jcr:title": "Site Settings",
+            "sling:resourceType": "sling-cms/components/caconfig/sitesettings",
+            "taxonomyroot": "/etc/taxonomy"
+        },
+        "templates": {
+            "jcr:primaryType": "sling:Config",
+            "jcr:title": "Templates",
+            "sling:resourceType": "sling-cms/components/caconfig/templates",
+            "base-page": {
+                "jcr:primaryType": "nt:unstructured",
+                "jcr:title": "Base Page",
+                "template": "{\r\n  \"jcr:primaryType\": \"sling:Page\",\r\n  \"jcr:content\": {\r\n    \"jcr:primaryType\": \"nt:unstructured\",\r\n    \"jcr:title\": \"{{title}}\",\r\n    \"sling:template\": \"/conf/${appName}/site/templates/base-page\",\r\n    \"sling:resourceType\": \"${appName}/components/page\",\r\n    \"published\": false\r\n  }\r\n}",
+                "allowedPaths": [
+                    "/content/${appName}.*"
+                ],
+                "sling:resourceType": "sling-cms/components/caconfig/template",
+                "fields": {
+                    "jcr:primaryType": "nt:unstructured",
+                    "text": {
+                        "jcr:primaryType": "nt:unstructured",
+                        "required": true,
+                        "name": "title",
+                        "type": "text",
+                        "label": "Title",
+                        "sling:resourceType": "sling-cms/components/editor/fields/text"
+                    },
+                    "text_1147023191": {
+                        "jcr:primaryType": "nt:unstructured",
+                        "required": true,
+                        "name": ":name",
+                        "type": "text",
+                        "label": "Name",
+                        "sling:resourceType": "sling-cms/components/editor/fields/text"
+                    }
+                },
+                "policies": {
+                    "jcr:primaryType": "nt:unstructured",
+                    "policymapping": {
+                        "jcr:primaryType": "nt:unstructured",
+                        "sling:resourceType": "sling-cms/components/caconfig/policymapping",
+                        "pathPattern": ".*",
+                        "policyPath": "/conf/${appName}/site/policies/policy"
+                    }
+                }
+            }
+        }
+    }
+}
diff --git a/archetype/src/main/resources/archetype-resources/src/test/java/__package__/HelloWorldModelTest.java b/archetype/src/main/resources/archetype-resources/src/test/java/__package__/HelloWorldModelTest.java
new file mode 100644
index 0000000..edaf866
--- /dev/null
+++ b/archetype/src/main/resources/archetype-resources/src/test/java/__package__/HelloWorldModelTest.java
@@ -0,0 +1,45 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package ${package};
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+
+import org.apache.sling.testing.mock.sling.junit.SlingContext;
+import org.junit.Before;
+import org.junit.Rule;
+import org.junit.Test;
+import org.mockito.Mockito;
+
+public class HelloWorldModelTest {
+    @Rule
+    public final SlingContext context = new SlingContext();
+
+    @Before
+    public void init() {
+        context.addModelsForPackage("${package}");
+        context.load().json("/resource.json", "/content");
+        context.currentResource("/content");
+    }
+
+    @Test
+    public void testModel() {
+        HelloWorldModel model = context.currentResource().adaptTo(HelloWorldModel.class);
+        assertNotNull(model);
+        assertEquals("Hello World!", model.getMessage());
+    }
+}
diff --git a/archetype/src/main/resources/archetype-resources/src/test/resources/resource.json b/archetype/src/main/resources/archetype-resources/src/test/resources/resource.json
new file mode 100644
index 0000000..dd70acd
--- /dev/null
+++ b/archetype/src/main/resources/archetype-resources/src/test/resources/resource.json
@@ -0,0 +1,3 @@
+{
+  "jcr:primaryType": "nt:unstructured"
+}
diff --git a/pom.xml b/pom.xml
index 58f51d0..5f73e28 100644
--- a/pom.xml
+++ b/pom.xml
@@ -1,8 +1,8 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<!-- Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional 
-    information regarding copyright ownership. The ASF licenses this file to you under the Apache License, Version 2.0 (the "License"); you may not use this file except 
-    in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to 
-    in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See 
+<!-- Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional
+    information regarding copyright ownership. The ASF licenses this file to you under the Apache License, Version 2.0 (the "License"); you may not use this file except
+    in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to
+    in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See
     the License for the specific language governing permissions and limitations under the License. -->
 <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
     xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
@@ -41,6 +41,7 @@
         <module>ui</module>
         <module>reference</module>
         <module>builder</module>
+        <module>archetype</module>
     </modules>
 
     <scm>