SLING-5156 - Create a Maven archetype building a slingstart application 

Initial version of the slingstart-maven-archetype

git-svn-id: https://svn.apache.org/repos/asf/sling/trunk@1708876 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/README.txt b/README.txt
new file mode 100644
index 0000000..5d9f3bc
--- /dev/null
+++ b/README.txt
@@ -0,0 +1,27 @@
+Sling Servlet Archetype
+
+Maven archetype for Sling Launchpad Standalone applications.
+
+Getting Started
+===============
+
+This component uses a Maven 2 (http://maven.apache.org/) build
+environment. It requires a Java 5 JDK (or higher) and Maven (http://maven.apache.org/)
+2.0.7 or later. We recommend to use the latest Maven version.
+
+If you have Maven 2 installed, you can install the jar into your local Maven repository
+using the following command:
+
+    mvn install
+
+See the Maven 2 documentation for other build features.
+
+The latest source code for this component is available in the
+Subversion (http://subversion.tigris.org/) source repository of
+the Apache Software Foundation. If you have Subversion installed,
+you can checkout the latest source using the following command:
+
+    svn checkout http://svn.apache.org/repos/asf/sling/trunk/tooling/maven/archetypes/launchpad-standalone
+
+See the Subversion documentation for other source control features.
+
diff --git a/pom.xml b/pom.xml
new file mode 100644
index 0000000..2f8c7d5
--- /dev/null
+++ b/pom.xml
@@ -0,0 +1,43 @@
+<?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 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">
+    <modelVersion>4.0.0</modelVersion>
+    <parent>
+        <groupId>org.apache.sling</groupId>
+        <artifactId>sling-archetype-parent</artifactId>
+        <version>1</version>
+        <relativePath/>
+    </parent>
+    <artifactId>sling-slingstart-archetype</artifactId>
+    <version>0.9.0-SNAPSHOT</version>
+    <packaging>maven-archetype</packaging>
+    <name>Sling Slingstart Archetype</name>
+    <description>Maven archetype for a Sling Slingstart application</description>
+
+    <scm>
+        <connection>scm:svn:http://svn.apache.org/repos/asf/sling/trunk/tooling/maven/archetypes/slingstart</connection>
+        <developerConnection>scm:svn:https://svn.apache.org/repos/asf/sling/trunk/tooling/maven/archetypes/slingstart</developerConnection>
+        <url>http://svn.apache.org/viewvc/sling/trunk/tooling/maven/archetypes/slingstart</url>
+    </scm>
+
+    <build>
+        <extensions>
+            <extension>
+                <groupId>org.apache.maven.archetype</groupId>
+                <artifactId>archetype-packaging</artifactId>
+                <version>${archetype.version}</version>
+            </extension>
+        </extensions>
+    </build>
+</project>
diff --git a/src/main/resources/META-INF/maven/archetype-metadata.xml b/src/main/resources/META-INF/maven/archetype-metadata.xml
new file mode 100644
index 0000000..3be2a3a
--- /dev/null
+++ b/src/main/resources/META-INF/maven/archetype-metadata.xml
@@ -0,0 +1,23 @@
+<?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 the License for the specific language governing permissions
+    and limitations under the License.
+-->
+<archetype-descriptor name="sling-launchpad-standalone">
+  <fileSets>
+    <fileSet filtered="true" encoding="UTF-8">
+      <directory>src/main/provisioning</directory>
+      <includes>
+        <include>*.txt</include>
+      </includes>
+    </fileSet>
+  </fileSets>
+</archetype-descriptor>
\ No newline at end of file
diff --git a/src/main/resources/META-INF/maven/archetype.xml b/src/main/resources/META-INF/maven/archetype.xml
new file mode 100644
index 0000000..be1831d
--- /dev/null
+++ b/src/main/resources/META-INF/maven/archetype.xml
@@ -0,0 +1,19 @@
+<?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 the License for the specific language governing permissions
+    and limitations under the License.
+-->
+<archetype>
+  <id>sling-slingstart</id>
+  <resources>
+    <resource>src/main/provisioning/model.txt</resource>
+  </resources>
+</archetype>
\ No newline at end of file
diff --git a/src/main/resources/archetype-resources/pom.xml b/src/main/resources/archetype-resources/pom.xml
new file mode 100644
index 0000000..f6c5e13
--- /dev/null
+++ b/src/main/resources/archetype-resources/pom.xml
@@ -0,0 +1,37 @@
+<?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 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">

+    <modelVersion>4.0.0</modelVersion>

+    <groupId>\${groupId}</groupId>

+    <artifactId>\${artifactId}</artifactId>

+    <version>\${version}</version>

+    <packaging>slingstart</packaging>

+    <name>\${artifactId} Slingstart</name>

+    <build>

+        <plugins>

+            <plugin>

+                <groupId>org.apache.sling</groupId>

+                <artifactId>slingstart-maven-plugin</artifactId>

+                <version>1.3.6</version>

+                <extensions>true</extensions>

+                <configuration>

+                    <createWebapp>true</createWebapp>

+                </configuration>

+            </plugin>

+        </plugins>

+    </build>

+    <properties>

+        <project.build.sourceEncoding>${project.build.sourceEncoding}</project.build.sourceEncoding>

+    </properties>    

+</project>

diff --git a/src/main/resources/archetype-resources/src/main/provisioning/model.txt b/src/main/resources/archetype-resources/src/main/provisioning/model.txt
new file mode 100644
index 0000000..7594324
--- /dev/null
+++ b/src/main/resources/archetype-resources/src/main/provisioning/model.txt
@@ -0,0 +1,23 @@
+#
+#  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.
+#
+[feature name=model]
+[artifacts]
+  org.apache.sling/org.apache.sling.launchpad/8-SNAPSHOT/slingstart
+  org.apache.felix/org.apache.felix.shell/1.4.3
+  org.apache.felix/org.apache.felix.shell.remote/1.1.2
\ No newline at end of file
diff --git a/src/test/resources/projects/normal/archetype.properties b/src/test/resources/projects/normal/archetype.properties
new file mode 100644
index 0000000..55830b4
--- /dev/null
+++ b/src/test/resources/projects/normal/archetype.properties
@@ -0,0 +1,4 @@
+groupId=org.apache.sling
+artifactId=test-slingstart-project
+version=0.0.1-SNAPSHOT
+package=org.apache.sling.archetype.launchpadstandalone.testing
\ No newline at end of file
diff --git a/src/test/resources/projects/normal/goal.txt b/src/test/resources/projects/normal/goal.txt
new file mode 100644
index 0000000..4a1a71d
--- /dev/null
+++ b/src/test/resources/projects/normal/goal.txt
@@ -0,0 +1 @@
+verify
\ No newline at end of file
diff --git a/src/test/resources/projects/normal/verify.groovy b/src/test/resources/projects/normal/verify.groovy
new file mode 100644
index 0000000..8e4bc97
--- /dev/null
+++ b/src/test/resources/projects/normal/verify.groovy
@@ -0,0 +1,9 @@
+new File(basedir, '.').eachFileRecurse(groovy.io.FileType.FILES) { logFile ->
+	if ( logFile.name == "build.log" ) {
+		logFile.eachLine { line ->
+			if ( line.contains("WARNING") ) {
+				throw new RuntimeException("Warning found in line ${line}\nIn file ${logFile}");
+			}
+		}
+	}
+}
\ No newline at end of file