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-feature-launcher-maven-plugin.git


The following commit(s) were added to refs/heads/master by this push:
     new fd765c1  SLING-10423 Add support to skip a launch (#2)
fd765c1 is described below

commit fd765c13db0bc30ac2a1ff10c3fd9b97281262e4
Author: Eric Norman <[email protected]>
AuthorDate: Wed May 26 16:43:14 2021 -0700

    SLING-10423 Add support to skip a launch (#2)
---
 README.md                                                        | 4 ++++
 .../java/org/apache/sling/maven/feature/launcher/Launch.java     | 9 +++++++++
 .../java/org/apache/sling/maven/feature/launcher/StartMojo.java  | 5 +++++
 .../java/org/apache/sling/maven/feature/launcher/StopMojo.java   | 5 +++++
 4 files changed, 23 insertions(+)

diff --git a/README.md b/README.md
index 6123aee..26ea191 100644
--- a/README.md
+++ b/README.md
@@ -19,6 +19,10 @@ Configure the plugin as follows:
         <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>
diff --git a/src/main/java/org/apache/sling/maven/feature/launcher/Launch.java 
b/src/main/java/org/apache/sling/maven/feature/launcher/Launch.java
index a801ad5..676732d 100644
--- a/src/main/java/org/apache/sling/maven/feature/launcher/Launch.java
+++ b/src/main/java/org/apache/sling/maven/feature/launcher/Launch.java
@@ -30,6 +30,7 @@ public class Launch {
     private Dependency feature;
     private LauncherArguments launcherArguments;
     private int startTimeoutSeconds = 30;
+    private boolean skip = false;
 
     public String getId() {
         return id;
@@ -63,6 +64,14 @@ public class Launch {
         this.startTimeoutSeconds = startTimeoutSeconds;
     }
 
+    public boolean isSkip() {
+        return skip;
+    }
+
+    public void setSkip(boolean skip) {
+        this.skip = skip;
+    }
+
     public void validate() {
         if ( id == null || id.trim().isEmpty() ) 
             throw new IllegalArgumentException("Missing id");
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 8706735..48df086 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
@@ -108,6 +108,11 @@ public class StartMojo extends AbstractMojo {
             workDir.mkdirs();
             
             for ( Launch launch : launches ) {
+                if (launch.isSkip()) {
+                    getLog().info("Skipping starting launch with id " + 
launch.getId());
+                    continue; // skip it
+                }
+
                 launch.validate();
 
                 Artifact artifact = toArtifact(launch.getFeature());
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 7be70f9..6087c5c 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
@@ -64,6 +64,11 @@ public class StopMojo extends AbstractMojo {
         }
         try {
             for ( Launch launch : launches ) {
+                if (launch.isSkip()) {
+                    getLog().info("Skipping stopping launch with id " + 
launch.getId());
+                    continue; // skip it
+                }
+
                 getLog().info("Stopping launch with id " + launch.getId());
                 processes.stop(launch.getId());
             }

Reply via email to