You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sling.apache.org by en...@apache.org on 2022/11/25 18:57:11 UTC

[sling-org-apache-sling-starter] branch master updated: SLING-11158 use feature launcher assembly to launch the starter (#63)

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

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


The following commit(s) were added to refs/heads/master by this push:
     new a3e51cd  SLING-11158 use feature launcher assembly to launch the starter (#63)
a3e51cd is described below

commit a3e51cd2b230acb1f5d001189baaf03d311f88fb
Author: Eric Norman <en...@apache.org>
AuthorDate: Fri Nov 25 10:57:07 2022 -0800

    SLING-11158 use feature launcher assembly to launch the starter (#63)
    
    unpack the feature launcher assembly during the build and change the
    readme instructions
---
 Dockerfile                       |  3 ++-
 README.md                        |  6 +++---
 pom.xml                          | 22 +++++++++++++++++-----
 src/main/container/bin/launch.sh |  5 ++---
 4 files changed, 24 insertions(+), 12 deletions(-)

diff --git a/Dockerfile b/Dockerfile
index bc1b014..42b8921 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -24,6 +24,7 @@ EXPOSE 8080
 RUN groupadd --system sling && \
     useradd --no-log-init --system --gid sling sling && \
     mkdir /opt/sling && \
+    mkdir /opt/sling/org.apache.sling.feature.launcher && \
     mkdir /opt/sling/launcher && \
     mkdir /opt/sling/artifacts && \
     chown -R sling:sling /opt/sling/launcher
@@ -31,7 +32,7 @@ RUN groupadd --system sling && \
 VOLUME /opt/sling/launcher
 
 COPY src/main/container /opt/sling
-COPY target/dependency/org.apache.sling.feature.launcher.jar /opt/sling
+COPY target/dependency/org.apache.sling.feature.launcher /opt/sling/org.apache.sling.feature.launcher
 COPY target/artifacts/ /opt/sling/artifacts/
 
 # ensure all files are readable by the sling user
diff --git a/README.md b/README.md
index be35d09..2a70872 100644
--- a/README.md
+++ b/README.md
@@ -30,7 +30,7 @@ Hint: You can defer stopping the instance after running the ITs with argument `-
 
 2) Start Sling backed by an Oak SegmentStore with
 
-        java -jar target/dependency/org.apache.sling.feature.launcher.jar -f target/slingfeature-tmp/feature-oak_tar.json
+        target/dependency/org.apache.sling.feature.launcher/bin/launcher -f target/slingfeature-tmp/feature-oak_tar.json
 
 3) Browse Sling in:
 
@@ -38,7 +38,7 @@ Hint: You can defer stopping the instance after running the ITs with argument `-
 
 For MongoDB support replace the launch command with
 
-    java -jar target/dependency/org.apache.sling.feature.launcher.jar -f target/slingfeature-tmp/feature-oak_mongo.json
+    target/dependency/org.apache.sling.feature.launcher/bin/launcher -f target/slingfeature-tmp/feature-oak_mongo.json
 
 This expects a MongoDB server to be running, search for `mongodb://` in the feature files for the expected URL
 (currently `mongodb://localhost:27017`).
@@ -107,7 +107,7 @@ start with the `nosample_base` aggregate, which contains:
 
 For instance, launching an empty Sling Starter with segment persistence can be achieved by running
 
-    java -jar target/dependency/org.apache.sling.feature.launcher.jar -f target/slingfeature-tmp/feature-nosample_base.json,target/slingfeature-tmp/feature-oak_persistence_sns.json
+    target/dependency/org.apache.sling.feature.launcher/bin/launcher -f target/slingfeature-tmp/feature-nosample_base.json,target/slingfeature-tmp/feature-oak_persistence_sns.json
     
 Your own feature files can be added to the feature list.
 
diff --git a/pom.xml b/pom.xml
index e2d6a74..31f4bfb 100644
--- a/pom.xml
+++ b/pom.xml
@@ -38,6 +38,7 @@
     <properties>
         <sling.java.version>8</sling.java.version>
         <starter.min.bundles.count>126</starter.min.bundles.count>
+        <sling.feature.launcher.version>1.2.0</sling.feature.launcher.version>
 
         <!-- versions to be replaced in the feature files -->
         <asm.version>9.3</asm.version>
@@ -166,14 +167,25 @@
                     <execution>
                         <id>prepare-feature-launcher</id>
                         <goals>
-                            <goal>get</goal>
-                            <goal>copy</goal>
+                            <goal>unpack</goal>
                         </goals>
                         <phase>package</phase>
                         <configuration>
-                            <!-- 1.1.28 and newer versions don't work out-of-the-box due to SLING-10956 -->
-                            <artifact>org.apache.sling:org.apache.sling.feature.launcher:1.1.26</artifact>
-                            <stripVersion>true</stripVersion>
+                            <artifactItems>
+                                <artifactItem>
+                                    <groupId>org.apache.sling</groupId>
+                                    <artifactId>org.apache.sling.feature.launcher</artifactId>
+                                    <version>${sling.feature.launcher.version}</version>
+                                    <type>tar.gz</type>
+                                    <!-- remove the version number from the unpacked folder -->
+                                    <fileMappers>
+                                        <org.codehaus.plexus.components.io.filemappers.RegExpFileMapper>
+                                            <pattern>\Qorg.apache.sling.feature.launcher-${sling.feature.launcher.version}\E</pattern>
+                                            <replacement>org.apache.sling.feature.launcher</replacement>
+                                        </org.codehaus.plexus.components.io.filemappers.RegExpFileMapper>
+                                    </fileMappers>
+                                </artifactItem>
+                            </artifactItems>
                         </configuration>
                     </execution>
                 </executions>
diff --git a/src/main/container/bin/launch.sh b/src/main/container/bin/launch.sh
index 26ac031..8a6b275 100755
--- a/src/main/container/bin/launch.sh
+++ b/src/main/container/bin/launch.sh
@@ -34,9 +34,8 @@ echo "[INFO] Automatically appended ${docker_feature}"
 feature="${feature},${docker_feature}"
 
 # remove add-opens after SLING-10831 is fixed
-exec java \
-    --add-opens java.base/java.lang=ALL-UNNAMED \
-    -jar org.apache.sling.feature.launcher.jar \
+export JAVA_OPTS="--add-opens java.base/java.lang=ALL-UNNAMED"
+exec org.apache.sling.feature.launcher/bin/launcher \
     -c artifacts \
     -CC "org.apache.sling.commons.log.LogManager=MERGE_LATEST" \
     -f ${feature}