This is an automated email from the ASF dual-hosted git repository. sseifert pushed a commit to branch feature/SLING-12942-windows-repo-path in repository https://gitbox.apache.org/repos/asf/sling-feature-launcher-maven-plugin.git
commit aa5d726166525f5df69b568a367e4fccc219b76b Author: Stefan Seifert <[email protected]> AuthorDate: Mon Sep 15 17:12:30 2025 +0200 SLING-12942 Fix building path URL to local maven repo on windows --- .../sling/maven/feature/launcher/StartMojo.java | 38 +++++++++++----------- 1 file changed, 19 insertions(+), 19 deletions(-) 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 1871d5d..c25ea83 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 @@ -81,7 +81,7 @@ public class StartMojo extends AbstractMojo { */ @Parameter( required = true, defaultValue = "1.3.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: @@ -103,7 +103,7 @@ public class StartMojo extends AbstractMojo { * <JAVA_HOME>...</JAVA_HOME> * </environmentVariables>} * </pre> - * + * * <p>If no repository URLs are configured the following defaults are used, in order: * <ul> * <li>The local Maven repository</li> @@ -117,7 +117,7 @@ public class StartMojo extends AbstractMojo { @Component private ArtifactResolver resolver; - + @Parameter(defaultValue = "${localRepository}", readonly = true) private ArtifactRepository localRepository; @@ -129,7 +129,7 @@ public class StartMojo extends AbstractMojo { @Parameter(property = "session", readonly = true, required = true) protected MavenSession mavenSession; - + @Component private ProcessTracker processes; @@ -182,7 +182,7 @@ public class StartMojo extends AbstractMojo { .getArtifact() .getFile(); } - + for ( Launch launch : launches ) { if (launch.isSkip()) { getLog().info("Skipping starting launch with id " + launch.getId()); @@ -190,13 +190,13 @@ public class StartMojo extends AbstractMojo { } launch.validate(); - + File featureFile = launch.getFeature(). map( this::toArtifact ) .map( a -> uncheckedResolveArtifact(repositorySession, a) ) .map( r -> r.getArtifact().getFile()) .orElseGet( () -> launch.getFeatureFile().get() ); // the Launch is guaranteed to either have a feature or a featureFile set - + String javahome = System.getenv(JAVA_HOME); if (javahome == null || javahome.isEmpty()) { // SLING-9843 fallback to java.home system property if JAVA_HOME env variable is not set @@ -249,9 +249,9 @@ public class StartMojo extends AbstractMojo { args.add("-jar"); args.add(launcher.getAbsolutePath()); } - + List<String> repositoryUrls; - + if ( launch.getRepositoryUrls() != null && !launch.getRepositoryUrls().isEmpty() ) { repositoryUrls = launch.getRepositoryUrls(); } else { @@ -260,26 +260,26 @@ public class StartMojo extends AbstractMojo { // configuration file $HOME/.m2/settings.xml but cannot find out if the Maven process was invoked // with a maven.repo.local argument repositoryUrls = new ArrayList<>(); - repositoryUrls.add("file://" + localRepository.getBasedir()); + repositoryUrls.add(new File(localRepository.getBasedir()).toURI().toString()); repositoryUrls.add("https://repo1.maven.org/maven2"); repositoryUrls.add("https://repository.apache.org/content/group/snapshots"); } - + args.add("-u"); StringJoiner joiner = new StringJoiner(","); repositoryUrls.forEach( joiner::add ); args.add(joiner.toString()); - + args.add("-f"); args.add(featureFile.getAbsolutePath()); args.add("-p"); args.add(launch.getId()); - + for ( Map.Entry<String, String> frameworkProperty : launch.getLauncherArguments().getFrameworkProperties().entrySet() ) { args.add("-D"); args.add(frameworkProperty.getKey()+"="+frameworkProperty.getValue()); } - + for ( Map.Entry<String, String> variable : launch.getLauncherArguments().getVariables().entrySet() ) { args.add("-V"); args.add(variable.getKey()+"="+variable.getValue()); @@ -295,13 +295,13 @@ public class StartMojo extends AbstractMojo { getLog().info("Setting environment variable '" + e.getKey() + "' to '" + e.getValue() + "'"); pb.environment().put(e.getKey(), e.getValue()); } ); - + getLog().info("Starting launch with id '" + launch.getId() + "', args=" + args); - + CountDownLatch latch = new CountDownLatch(1); - + Process process = pb.start(); - + Thread monitor = new Thread("launch-monitor-" + launch.getId()) { @Override public void run() { @@ -327,7 +327,7 @@ public class StartMojo extends AbstractMojo { ProcessTracker.stop(process); throw new MojoExecutionException("Launch " + launch.getId() + " failed to start in " + launch.getStartTimeoutSeconds() + " seconds."); } - + processes.startTracking(launch.getId(), process); }
