This is an automated email from the ASF dual-hosted git repository. rombert pushed a commit to branch feature/SLING-10601 in repository https://gitbox.apache.org/repos/asf/sling-project-archetype.git
commit f6c812aabd012a0fa820a686d38342ac7d809c2d Author: Robert Munteanu <[email protected]> AuthorDate: Tue Jul 13 12:31:58 2021 +0300 SLING-10601 - Add a launcher module to the project archetype Add a launcher module, always generated. --- .../META-INF/maven/archetype-metadata.xml | 16 +++ .../resources/archetype-resources/README.All.md | 7 +- .../resources/archetype-resources/README.NotAll.md | 7 +- .../archetype-resources/launcher/launch.sh | 24 +++++ .../resources/archetype-resources/launcher/pom.xml | 120 +++++++++++++++++++++ .../launcher/src/main/features/launcher.json | 13 +++ src/main/resources/archetype-resources/pom.xml | 19 ++++ src/test/resources/projects/all/verify.groovy | 25 +++++ 8 files changed, 227 insertions(+), 4 deletions(-) diff --git a/src/main/resources/META-INF/maven/archetype-metadata.xml b/src/main/resources/META-INF/maven/archetype-metadata.xml index 265f9ed..84a9bd3 100644 --- a/src/main/resources/META-INF/maven/archetype-metadata.xml +++ b/src/main/resources/META-INF/maven/archetype-metadata.xml @@ -158,6 +158,22 @@ </fileSet> </fileSets> </module> + <module id="launcher" dir="launcher" name="launcher"> + <fileSets> + <fileSet filtered="true" encoding="UTF-8"> + <directory>src/main/features</directory> + <includes> + <include>**/*.json</include> + </includes> + </fileSet> + <fileSet encoding="UTF-8"> + <directory></directory> + <includes> + <include>*.sh</include> + </includes> + </fileSet> + </fileSets> + </module> <module id="all" dir="all" name="all"> <!--<fileSets>--> <!--<fileSet filtered="true" encoding="UTF-8">--> diff --git a/src/main/resources/archetype-resources/README.All.md b/src/main/resources/archetype-resources/README.All.md index 56a33ea..e20dcbf 100644 --- a/src/main/resources/archetype-resources/README.All.md +++ b/src/main/resources/archetype-resources/README.All.md @@ -22,7 +22,7 @@ #### Introduction This project was created by the Full Project Sling Maven Archetype which created -three modules: +four modules: 1. **core**: OSGi Bundle which is deployed as OSGi Bundle to Sling which includes your Servlets, Filters, Sling Models and much more. This module is **not intended** @@ -30,7 +30,9 @@ three modules: 2. **ui.apps**: JCR Content Module which is used to install a JCR Package into Sling by using **Composum**. For that it must be installed and the Composum Package Manager must be whitelisted. -3. **all**: This is another JCR Content Module but it is only used to install the +3. **launcher**: Feature model module which assembles a full application from the project + which can then be launched using the included `./launch.sh` script +4. **all**: This is another JCR Content Module but it is only used to install the other two modules. There are also two more modules that provide some examples with the same name plus @@ -101,6 +103,7 @@ with **core.example** and **ui.apps.example**. <module>core.example</module> <module>ui.apps</module> <module>ui.apps.example</module> + <module>launcher</module> <module>all</module> </modules> diff --git a/src/main/resources/archetype-resources/README.NotAll.md b/src/main/resources/archetype-resources/README.NotAll.md index 3e69d10..31b40b6 100644 --- a/src/main/resources/archetype-resources/README.NotAll.md +++ b/src/main/resources/archetype-resources/README.NotAll.md @@ -22,12 +22,14 @@ #### Introduction This project was created by the Sling Project Maven Archetype which created -two modules: +three modules: 1. **core**: OSGi Bundle which is deployed as OSGi Bundle to Sling which includes your Servlets, Filters, Sling Models and much more. This module is **not intended** to contain Sling Content. -2. **ui.apps**: JCR Content Module which is used to install a JCR Package into Sling +2. **launcher**: Feature model module which assembles a full application from the project + which can then be launched using the included `./launch.sh` script +3. **ui.apps**: JCR Content Module which is used to install a JCR Package into Sling by using **Composum**. For that it must be installed and the Composum Package Manager must be whitelisted. @@ -50,6 +52,7 @@ with **core.example** and **ui.apps.example**. <module>core.example</module> <module>ui.apps</module> <module>ui.apps.example</module> + <module>launcher</module> </modules> #### Why a JCR Package instead of a Content Bundle diff --git a/src/main/resources/archetype-resources/launcher/launch.sh b/src/main/resources/archetype-resources/launcher/launch.sh new file mode 100755 index 0000000..79c5771 --- /dev/null +++ b/src/main/resources/archetype-resources/launcher/launch.sh @@ -0,0 +1,24 @@ +#!/bin/sh -eu +# +# 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. +# + +echo '-------------------------------------------------------------------------------------------' +echo '[NOTE] Launching application, this will fail if you did not build the project at least once' +echo '[NOTE] Remove the launcher folder to throw away local changes' +echo '-------------------------------------------------------------------------------------------' + +java -jar target/dependency/org.apache.sling.feature.launcher.jar -f target/slingfeature-tmp/feature-app.json diff --git a/src/main/resources/archetype-resources/launcher/pom.xml b/src/main/resources/archetype-resources/launcher/pom.xml new file mode 100644 index 0000000..5d1c0f5 --- /dev/null +++ b/src/main/resources/archetype-resources/launcher/pom.xml @@ -0,0 +1,120 @@ +<?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>\${rootArtifactId}</artifactId> + <groupId>\${groupId}</groupId> + <version>\${version}</version> + <relativePath>../pom.xml</relativePath> + </parent> + + <artifactId>\${artifactId}</artifactId> + + <name>\${artifactName} - Launcher</name> + <description> + This is a Module which contains a sample feature model build, built on + top of the Sling Starter and adding this project's artifacts. + </description> + <build> + <plugins> + <plugin> + <groupId>org.apache.sling</groupId> + <artifactId>slingfeature-maven-plugin</artifactId> + <extensions>true</extensions> + + <configuration> + <skipAddFeatureDependencies>true</skipAddFeatureDependencies> + <framework> + <groupId>org.apache.felix</groupId> + <artifactId>org.apache.felix.framework</artifactId> + <version>\${org.apache.felix.framework.version}</version> + </framework> + + <!-- + Prepares a feature model aggregate that takes the following features from + the Sling Starter: + - nosample_base - the base Sling Starter + - oak_persistence_sns - SegmentNodeStore persistence for Oak + - composum - The Composum Nodes administration tool + + Notably missing are the slingshot and starter samples + --> + <aggregates> + <aggregate> + <classifier>app</classifier> + <filesInclude>*.json</filesInclude> + <includeArtifact> + <groupId>org.apache.sling</groupId> + <artifactId>org.apache.sling.starter</artifactId> + <classifier>nosample_base</classifier> + <version>\${sling.starter.version}</version> + <type>slingosgifeature</type> + </includeArtifact> + <includeArtifact> + <groupId>org.apache.sling</groupId> + <artifactId>org.apache.sling.starter</artifactId> + <classifier>oak_persistence_sns</classifier> + <version>\${sling.starter.version}</version> + <type>slingosgifeature</type> + </includeArtifact> + <includeArtifact> + <groupId>org.apache.sling</groupId> + <artifactId>org.apache.sling.starter</artifactId> + <classifier>composum</classifier> + <version>\${sling.starter.version}</version> + <type>slingosgifeature</type> + </includeArtifact> + </aggregate> + </aggregates> + <scans> + <scan> + <includeClassifier>app</includeClassifier> + </scan> + </scans> + </configuration> + <executions> + <execution> + <id>prepare-features</id> + <phase>prepare-package</phase> + <goals> + <goal>aggregate-features</goal> + <goal>analyse-features</goal> + <goal>attach-features</goal> + </goals> + </execution> + </executions> + </plugin> + <plugin> + <artifactId>maven-dependency-plugin</artifactId> + <executions> + <execution> + <id>prepare-feature-launcher</id> + <goals> + <goal>get</goal> + <goal>copy</goal> + </goals> + <phase>package</phase> + <configuration> + <artifact>org.apache.sling:org.apache.sling.feature.launcher:\${org.apache.sling.feature.launcher.version}</artifact> + <stripVersion>true</stripVersion> + </configuration> + </execution> + </executions> + </plugin> + </plugins> + </build> +</project> diff --git a/src/main/resources/archetype-resources/launcher/src/main/features/launcher.json b/src/main/resources/archetype-resources/launcher/src/main/features/launcher.json new file mode 100644 index 0000000..78bd13b --- /dev/null +++ b/src/main/resources/archetype-resources/launcher/src/main/features/launcher.json @@ -0,0 +1,13 @@ +{ + "bundles": [ + { + "id": "${groupId}/core/${version}", + "start-order": 20 + } + ], + "content-packages:ARTIFACTS|required": [ + { + "id":"${groupId}/ui.apps/${version}/zip" + } + ] +} \ No newline at end of file diff --git a/src/main/resources/archetype-resources/pom.xml b/src/main/resources/archetype-resources/pom.xml index 67f453c..9632545 100644 --- a/src/main/resources/archetype-resources/pom.xml +++ b/src/main/resources/archetype-resources/pom.xml @@ -75,6 +75,7 @@ <wcmio.plugin.version>1.7.6</wcmio.plugin.version> <!-- TODO: Could not upgrade to 1.1.x as some tests prevent the creation of All packages --> <filevault-package.plugin.version>1.0.4</filevault-package.plugin.version> + <slingfeature.plugin.version>1.5.10</slingfeature.plugin.version> <osgi.core.version>7.0.0</osgi.core.version> <osgi.annotation.version>7.0.0</osgi.annotation.version> @@ -84,14 +85,19 @@ <javax.servlet-api.version>3.1.0</javax.servlet-api.version> <javax.inject.version>1</javax.inject.version> <jcr.version>2.0</jcr.version> + <org.apache.felix.framework.version>7.0.1</org.apache.felix.framework.version> <org.apache.sling.api.version>2.22.0</org.apache.sling.api.version> <org.apache.sling.models.api.version>1.3.8</org.apache.sling.models.api.version> + <org.apache.sling.feature.launcher.version>1.1.20</org.apache.sling.feature.launcher.version> <jetbrains.annotations.version>19.0.0</jetbrains.annotations.version> <org.apache.sling.settings.version>1.3.10</org.apache.sling.settings.version> <org.apache.sling.commons.osgi.version>2.4.0</org.apache.sling.commons.osgi.version> <jackrabbit-api.version>2.19.3</jackrabbit-api.version> <commons-lang3.version>3.9</commons-lang3.version> <jmock-junit4.version>2.8.2</jmock-junit4.version> + + <!-- TODO - switch to released version once available --> + <sling.starter.version>12-SNAPSHOT</sling.starter.version> </properties> <build> @@ -276,6 +282,19 @@ <artifactId>build-helper-maven-plugin</artifactId> <version>${build.helper.plugin.version}</version> </plugin> + <!-- SlingFeature Plugin --> + <plugin> + <groupId>org.apache.sling</groupId> + <artifactId>slingfeature-maven-plugin</artifactId> + <version>\${slingfeature.plugin.version}</version> + <dependencies> + <dependency> + <groupId>org.apache.sling</groupId> + <artifactId>org.apache.sling.feature.launcher</artifactId> + <version>\${org.apache.sling.feature.launcher.version}</version> + </dependency> + </dependencies> + </plugin> </plugins> </pluginManagement> </build> diff --git a/src/test/resources/projects/all/verify.groovy b/src/test/resources/projects/all/verify.groovy new file mode 100644 index 0000000..5fd2c84 --- /dev/null +++ b/src/test/resources/projects/all/verify.groovy @@ -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. + */ + +def fileNames = ["pom.xml", "launcher/pom.xml", "launcher/launch.sh"] + +fileNames.each { fileName -> + def file = new File(context.projectDir, fileName); + assert file.exists() : "File ${file} does not exist" +} + +return true \ No newline at end of file
