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

rombert pushed a commit to branch feature/SLING-9526
in repository https://gitbox.apache.org/repos/asf/sling-whiteboard.git

commit 71002f771086761206bb17f72687e6a133456d29
Author: Robert Munteanu <[email protected]>
AuthorDate: Thu Jun 25 17:13:53 2020 +0200

    SLING-9526 - Allow launching feature model applications in external 
processes, non-blocking
    
    No longer require configuring a dependency to the feature model launcher.
---
 feature-launcher-maven-plugin/pom.xml              |  6 ----
 .../src/it/simple-it/pom.xml                       |  5 ----
 .../sling/maven/feature/launcher/StartMojo.java    | 32 ++++++++++------------
 3 files changed, 15 insertions(+), 28 deletions(-)

diff --git a/feature-launcher-maven-plugin/pom.xml 
b/feature-launcher-maven-plugin/pom.xml
index 7e744bd..2041b5d 100644
--- a/feature-launcher-maven-plugin/pom.xml
+++ b/feature-launcher-maven-plugin/pom.xml
@@ -70,12 +70,6 @@
         </dependency>
         
         <dependency>
-            <groupId>org.apache.sling</groupId>
-            <artifactId>org.apache.sling.feature.launcher</artifactId>
-            <version>1.1.4</version>
-        </dependency>
-        
-        <dependency>
             <groupId>org.apache.maven</groupId>
             <artifactId>maven-compat</artifactId>
             <version>${maven.version}</version>
diff --git a/feature-launcher-maven-plugin/src/it/simple-it/pom.xml 
b/feature-launcher-maven-plugin/src/it/simple-it/pom.xml
index 862df63..7dad8f7 100644
--- a/feature-launcher-maven-plugin/src/it/simple-it/pom.xml
+++ b/feature-launcher-maven-plugin/src/it/simple-it/pom.xml
@@ -26,11 +26,6 @@
 
     <dependencies>
         <dependency>
-            <groupId>org.apache.sling</groupId>
-            <artifactId>org.apache.sling.feature.launcher</artifactId>
-            <version>1.1.2</version>
-        </dependency>
-        <dependency>
             <groupId>org.junit.jupiter</groupId>
             <artifactId>junit-jupiter-api</artifactId>
             <version>5.6.2</version>
diff --git 
a/feature-launcher-maven-plugin/src/main/java/org/apache/sling/maven/feature/launcher/StartMojo.java
 
b/feature-launcher-maven-plugin/src/main/java/org/apache/sling/maven/feature/launcher/StartMojo.java
index d62789f..ff66ad5 100644
--- 
a/feature-launcher-maven-plugin/src/main/java/org/apache/sling/maven/feature/launcher/StartMojo.java
+++ 
b/feature-launcher-maven-plugin/src/main/java/org/apache/sling/maven/feature/launcher/StartMojo.java
@@ -44,19 +44,22 @@ import org.eclipse.aether.RepositorySystemSession;
 import org.eclipse.aether.artifact.Artifact;
 import org.eclipse.aether.artifact.DefaultArtifact;
 import org.eclipse.aether.impl.ArtifactResolver;
+import org.eclipse.aether.repository.RemoteRepository;
 import org.eclipse.aether.resolution.ArtifactRequest;
 import org.eclipse.aether.resolution.ArtifactResolutionException;
 import org.eclipse.aether.resolution.ArtifactResult;
 
 @Mojo( name = "start", defaultPhase = LifecyclePhase.PRE_INTEGRATION_TEST )
-public class StartMojo
-    extends AbstractMojo
-{
+public class StartMojo extends AbstractMojo {
+    
     /**
      * Location of the file.
      */
     @Parameter( defaultValue = "${project.build.directory}", property = 
"outputDir", required = true )
     private File outputDirectory;
+
+    @Parameter( required = true, defaultValue = "1.1.4")
+    private String featureLauncherVersion;
     
     @Parameter(required = true)
     private List<Launch> launches;
@@ -78,6 +81,9 @@ public class StartMojo
     @Component
     private ArtifactResolver resolver;
 
+    @Parameter(defaultValue = "${project.remotePluginRepositories}", readonly 
= true)
+    private List<RemoteRepository> remoteRepos;
+
     @Parameter(property = "project", readonly = true, required = true)
     protected MavenProject project;
 
@@ -87,22 +93,14 @@ public class StartMojo
     @Component
     private ProcessTracker processes;
     
-    public void execute()
-        throws MojoExecutionException, MojoFailureException
-    {
-        
+    public void execute() throws MojoExecutionException, MojoFailureException {
+
+        Artifact launcherArtifact = new 
DefaultArtifact("org.apache.sling:org.apache.sling.feature.launcher:" + 
featureLauncherVersion);
+
         try {
             RepositorySystemSession repositorySession = 
mavenSession.getRepositorySession();
-            
-            // TODO - this should be inferred from the plugin's pom.xml 
dependency (not the project's pom.xml)
-            Dependency featureLauncherDep = project.getDependencies().stream()
-                .filter( d -> d.getGroupId().equals("org.apache.sling") && 
d.getArtifactId().equals("org.apache.sling.feature.launcher"))
-                .findFirst()
-                .orElseThrow( () -> new MojoFailureException("No feature 
launcher dependency found"));
-            
-            Artifact launcherArtifact = toArtifact(featureLauncherDep);
             File launcher = resolver
-                .resolveArtifact(repositorySession, new 
ArtifactRequest(launcherArtifact, null, null))
+                .resolveArtifact(repositorySession, new 
ArtifactRequest(launcherArtifact, remoteRepos, null))
                 .getArtifact()
                 .getFile();
             
@@ -114,7 +112,7 @@ public class StartMojo
 
                 Artifact artifact = toArtifact(launch.getFeature());
                 
-                ArtifactResult result = 
resolver.resolveArtifact(repositorySession, new ArtifactRequest(artifact, null, 
null));
+                ArtifactResult result = 
resolver.resolveArtifact(repositorySession, new ArtifactRequest(artifact, 
remoteRepos, null));
                 File featureFile = result.getArtifact().getFile();
                 
                 List<String> args = new ArrayList<>();

Reply via email to