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

[sling-feature-launcher-maven-plugin] branch master updated: SLING-11528 Provide Maven Site (#11)

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

kwin pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/sling-feature-launcher-maven-plugin.git


The following commit(s) were added to refs/heads/master by this push:
     new 95ce6da  SLING-11528 Provide Maven Site (#11)
95ce6da is described below

commit 95ce6da387ff1acae092cd981203d4f0a7ecaabb
Author: Konrad Windszus <kw...@apache.org>
AuthorDate: Thu Aug 11 15:53:13 2022 +0200

    SLING-11528 Provide Maven Site (#11)
    
    Update to latest parent
    Update dependencies, remove superfluous ones
    Migrate from Plexus to JSR 330
    (https://github.com/eclipse/sisu.plexus/wiki/Plexus-to-JSR330)
---
 pom.xml                                            | 63 +++++++++++++---------
 .../maven/feature/launcher/ProcessTracker.java     |  6 ++-
 .../sling/maven/feature/launcher/StartMojo.java    | 42 ++++++++-------
 .../sling/maven/feature/launcher/StopMojo.java     | 22 +++++++-
 src/site/markdown/index.md                         | 59 ++++++++++++++++++++
 src/site/site.xml                                  | 30 +++++++++++
 6 files changed, 177 insertions(+), 45 deletions(-)

diff --git a/pom.xml b/pom.xml
index 8909ea6..e9de3d1 100644
--- a/pom.xml
+++ b/pom.xml
@@ -22,7 +22,7 @@
     <parent>
         <groupId>org.apache.sling</groupId>
         <artifactId>sling</artifactId>
-        <version>47</version>
+        <version>49</version>
         <relativePath />
     </parent>
 
@@ -35,7 +35,7 @@
     <scm>
         <connection>scm:git:https://gitbox.apache.org/repos/asf/sling-feature-launcher-maven-plugin.git</connection>
         <developerConnection>scm:git:https://gitbox.apache.org/repos/asf/sling-feature-launcher-maven-plugin.git</developerConnection>
-        <url>https://gitbox.apache.org/repos/asf?p=sling-feature-launcher-maven-plugin.git</url>
+        <url>https://github.com/apache/sling-feature-launcher-maven-plugin</url>
         <tag>HEAD</tag>
     </scm>
 
@@ -48,6 +48,8 @@
         <sling.java.version>8</sling.java.version>
         <maven.version>3.3.9</maven.version>
         <project.build.outputTimestamp>1</project.build.outputTimestamp>
+        <github.project.id>apache/sling-feature-launcher-maven-plugin</github.project.id>
+        <maven.compiler.target>${sling.java.version}</maven.compiler.target><!-- also set target next to release due to https://issues.apache.org/jira/browse/MPLUGIN-404 -->
     </properties>
 
     <dependencies>
@@ -72,50 +74,44 @@
         <dependency>
             <groupId>org.apache.maven.plugin-tools</groupId>
             <artifactId>maven-plugin-annotations</artifactId>
-            <version>3.6.0</version>
             <scope>provided</scope>
         </dependency>
+        <dependency>
+            <groupId>javax.inject</groupId>
+            <artifactId>javax.inject</artifactId>
+            <scope>compile</scope>
+        </dependency>
         <dependency>
             <groupId>org.codehaus.plexus</groupId>
             <artifactId>plexus-interactivity-api</artifactId>
-            <version>1.0</version>
+            <version>1.1</version>
+            <scope>compile</scope>
         </dependency>
         <dependency>
             <groupId>org.apache.maven.shared</groupId>
             <artifactId>maven-shared-utils</artifactId>
-            <version>3.3.3</version>
-        </dependency>
-        
-        <dependency>
-            <groupId>org.apache.maven</groupId>
-            <artifactId>maven-compat</artifactId>
-            <version>${maven.version}</version>
-            <scope>test</scope>
+            <version>3.3.4</version>
+            <scope>compile</scope>
         </dependency>
         <dependency>
             <groupId>junit</groupId>
             <artifactId>junit</artifactId>
             <scope>test</scope>
         </dependency>
-        <dependency>
-            <groupId>org.apache.maven.plugin-testing</groupId>
-            <artifactId>maven-plugin-testing-harness</artifactId>
-            <version>3.3.0</version>
-            <scope>test</scope>
-        </dependency>
     </dependencies>
 
     <build>
         <plugins>
+            <!-- generate index for Sisu -->
             <plugin>
-                <groupId>org.codehaus.plexus</groupId>
-                <artifactId>plexus-component-metadata</artifactId>
-                <version>1.7.1</version>
+                <groupId>org.eclipse.sisu</groupId>
+                <artifactId>sisu-maven-plugin</artifactId>
+                <version>0.3.5</version>
                 <executions>
                     <execution>
-                        <id>generate-metadata</id>
+                        <id>index-project</id>
                         <goals>
-                            <goal>generate-metadata</goal>
+                            <goal>main-index</goal>
                         </goals>
                     </execution>
                 </executions>
@@ -123,7 +119,6 @@
             <plugin>
                 <groupId>org.apache.maven.plugins</groupId>
                 <artifactId>maven-plugin-plugin</artifactId>
-                <version>3.6.0</version>
                 <configuration>
                     <!-- <goalPrefix>maven-archetype-plugin</goalPrefix> -->
                     <skipErrorNoDescriptorsFound>true</skipErrorNoDescriptorsFound>
@@ -155,6 +150,7 @@
                     <postBuildHookScript>verify</postBuildHookScript>
                     <localRepositoryPath>${project.build.directory}/local-repo</localRepositoryPath>
                     <settingsFile>src/it/settings.xml</settingsFile>
+                    <streamLogsOnFailures>true</streamLogsOnFailures>
                     <goals>
                         <goal>clean</goal>
                         <goal>verify</goal>
@@ -173,4 +169,23 @@
             </plugin>
         </plugins>
     </build>
+    
+    <reporting>
+        <plugins>
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-plugin-plugin</artifactId>
+            </plugin>
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-javadoc-plugin</artifactId>
+                <configuration>
+                  <!-- No javadocs -->
+                    <excludePackageNames>
+                        org.apache.sling
+                    </excludePackageNames>
+                </configuration>
+            </plugin>
+        </plugins>
+    </reporting>
 </project>
diff --git a/src/main/java/org/apache/sling/maven/feature/launcher/ProcessTracker.java b/src/main/java/org/apache/sling/maven/feature/launcher/ProcessTracker.java
index 694a453..cc26d5e 100644
--- a/src/main/java/org/apache/sling/maven/feature/launcher/ProcessTracker.java
+++ b/src/main/java/org/apache/sling/maven/feature/launcher/ProcessTracker.java
@@ -22,9 +22,11 @@ import java.util.HashMap;
 import java.util.Map;
 import java.util.concurrent.TimeUnit;
 
-import org.codehaus.plexus.component.annotations.Component;
+import javax.inject.Named;
+import javax.inject.Singleton;
 
-@Component(role = ProcessTracker.class)
+@Named
+@Singleton
 public class ProcessTracker {
 
     static void stop(Process process) throws InterruptedException {
diff --git a/src/main/java/org/apache/sling/maven/feature/launcher/StartMojo.java b/src/main/java/org/apache/sling/maven/feature/launcher/StartMojo.java
index 6676dc7..c1f9970 100644
--- a/src/main/java/org/apache/sling/maven/feature/launcher/StartMojo.java
+++ b/src/main/java/org/apache/sling/maven/feature/launcher/StartMojo.java
@@ -49,37 +49,43 @@ import org.eclipse.aether.resolution.ArtifactRequest;
 import org.eclipse.aether.resolution.ArtifactResolutionException;
 import org.eclipse.aether.resolution.ArtifactResult;
 
+/**
+ * Start one or multiple <a href="https://sling.apache.org/documentation/development/feature-model.html">Sling Feature(s)</a>.
+ */
 @Mojo( name = "start", defaultPhase = LifecyclePhase.PRE_INTEGRATION_TEST )
 public class StartMojo extends AbstractMojo {
     
     /**
-     * Location of the file.
+     * The directory in which the features are launched (below its child directory {@code launchers/<launch-id>}).
      */
     @Parameter( defaultValue = "${project.build.directory}", property = "outputDir", required = true )
     private File outputDirectory;
 
+    /**
+     * The version of the <a href="https://github.com/apache/sling-org-apache-sling-feature-launcher">Sling Feature Launcher</a> to use.
+     */
     @Parameter( required = true, defaultValue = "1.1.4")
     private String featureLauncherVersion;
     
+    // TODO: extract this field into common parent class
+    /**
+     * List of {@link Launch} objects to start. Each is having the following format:
+     * <pre>{@code
+     * <id>...</id> <!-- the id of the launch, must be unique within the list, is mandatory -->
+     * <dependency>...</dependency> <!-- the Maven coordinates of the feature model -->
+     * <launcherArguments> <!-- additional arguments to pass to the launcher -->
+     *   <frameworkProperties>
+     *     <org.osgi.service.http.port>8090</org.osgi.service.http.port>
+     *   </framweworkProperties>
+     *   ..
+     * </launcherArguments>
+     * <environmentVariables><!--additional environment variables to pass to the launcher -->
+     *  <JAVA_HOME>...</JAVA_HOME>
+     * </environmentVariables>}
+     * </pre>
+     */
     @Parameter(required = true)
     private List<Launch> launches;
-    
-    // <launches>
-    //   <launch>
-    //     <id>...</id>
-    //     <dependency>...</dependency>
-    //     <launcherArguments>
-    //        <frameworkProperties>
-    //          <org.osgi.service.http.port>8090</org.osgi.service.http.port>
-    //        </framweworkProperties>
-    //        ...
-    //     </launcherArguments>
-    //     <environmentVariables>
-    //        <JAVA_HOME>...</JAVA_HOME>
-    //     </environmentVariables>
-
-    @Parameter
-    private Map<String, String> environmentVariables;
 
     @Component
     private ArtifactResolver resolver;
diff --git a/src/main/java/org/apache/sling/maven/feature/launcher/StopMojo.java b/src/main/java/org/apache/sling/maven/feature/launcher/StopMojo.java
index 6087c5c..b84a59a 100644
--- a/src/main/java/org/apache/sling/maven/feature/launcher/StopMojo.java
+++ b/src/main/java/org/apache/sling/maven/feature/launcher/StopMojo.java
@@ -32,9 +32,29 @@ import org.apache.maven.shared.utils.logging.MessageUtils;
 import org.codehaus.plexus.components.interactivity.Prompter;
 import org.codehaus.plexus.components.interactivity.PrompterException;
 
+/**
+ * Stop one or multiple <a href="https://sling.apache.org/documentation/development/feature-model.html">Sling Feature(s)</a>.
+ */
 @Mojo( name = "stop", defaultPhase = LifecyclePhase.POST_INTEGRATION_TEST)
 public class StopMojo extends AbstractMojo {
 
+    // TODO: extract this field into common parent class
+    /**
+     * List of {@link Launch} objects to start. Each is having the following format:
+     * <pre>{@code
+     * <id>...</id> <!-- the id of the launch, must be unique within the list, is mandatory -->
+     * <dependency>...</dependency> <!-- the Maven coordinates of the feature model -->
+     * <launcherArguments> <!-- additional arguments to pass to the launcher -->
+     *   <frameworkProperties>
+     *     <org.osgi.service.http.port>8090</org.osgi.service.http.port>
+     *   </framweworkProperties>
+     *   ..
+     * </launcherArguments>
+     * <environmentVariables><!--additional environment variables to pass to the launcher -->
+     *  <JAVA_HOME>...</JAVA_HOME>
+     * </environmentVariables>}
+     * </pre>
+     */
     @Parameter(required = true)
     private List<Launch> launches;
     
@@ -42,7 +62,7 @@ public class StopMojo extends AbstractMojo {
     private ProcessTracker processes;
     
     /**
-     * If {@code true} stopping the server is deferred until you press the Enter key.
+     * If {@code true} stopping the server is deferred until you press the Enter key on the terminal on which Maven is executed.
      */
     @Parameter(property = "feature-launcher.waitForInput", required = false, defaultValue = "false")
     protected boolean waitForInput;
diff --git a/src/site/markdown/index.md b/src/site/markdown/index.md
new file mode 100644
index 0000000..f26d253
--- /dev/null
+++ b/src/site/markdown/index.md
@@ -0,0 +1,59 @@
+Sling Feature Launcher Maven Plugin
+==================
+
+The Sling Feature Launcher Maven Plugin can start and stop existing [Sling Features](https://sling.apache.org/documentation/development/feature-model.html).
+It leverages the [Sling Feature Launcher](https://github.com/apache/sling-org-apache-sling-feature-launcher).
+
+## Example Usage
+
+```
+<plugin>
+    <groupId>org.apache.sling</groupId>
+    <artifactId>feature-launcher-maven-plugin</artifactId>
+    <configuration>
+        <launches>
+            <launch>
+                <id>model</id>
+                <!-- optionally uncomment to skip this launch if the skip property resolves to false -->
+                <!--
+                <skip>${prop1.skip}</skip>
+                -->
+                <feature>
+                    <groupId>org.apache.sling</groupId>
+                    <artifactId>org.apache.sling.starter</artifactId>
+                    <version>12</version>
+                    <classifier>oak_tar</classifier>
+                    <type>slingosgifeature</type>
+                </feature>
+                <launcherArguments>
+                    <!-- optionally uncomment to pass any required extra vm options -->
+                    <!--
+                    <vmOptions>
+                        <value>-Xmx512m</value>
+                        <value>-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=5000</value>
+                    </vmOptions>
+                    -->
+                    <frameworkProperties>
+                        <org.osgi.service.http.port>8080</org.osgi.service.http.port>
+                    </frameworkProperties>
+                    <!-- Feature launcher variables can be set like this -->
+                    <variables>
+                        <TEST_VARIABLE>TEST_VALUE</TEST_VARIABLE>
+                    </variables>
+                </launcherArguments>
+                <startTimeoutSeconds>180</startTimeoutSeconds>
+            </launch>
+        </launches>
+    </configuration>
+    <executions>
+        <execution>
+            <goals>
+                <goal>start</goal>
+                <goal>stop</goal>
+            </goals>
+        </execution>
+    </executions>
+</plugin>
+```
+
+See [Goals](plugin-info.html) for a list of supported goals.
diff --git a/src/site/site.xml b/src/site/site.xml
new file mode 100644
index 0000000..ed0c80c
--- /dev/null
+++ b/src/site/site.xml
@@ -0,0 +1,30 @@
+<?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>
+  <body>
+    <menu name="Overview">
+      <item name="Introduction" href="index.html"/>
+      <item name="Goals" href="plugin-info.html"/>
+    </menu>
+    <menu ref="reports"/>
+  </body>
+</project>