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

gnodet pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/maven-integration-testing.git


The following commit(s) were added to refs/heads/master by this push:
     new ef425040e Change bootstrap syntax to align with the usual one (#316)
ef425040e is described below

commit ef425040e2a0d3e8da3dd58e9c99de3a2248964b
Author: Guillaume Nodet <gno...@apache.org>
AuthorDate: Sun Nov 26 07:35:09 2023 +0100

    Change bootstrap syntax to align with the usual one (#316)
---
 .../src/test/resources-filtered/bootstrap.txt      |  8 ++---
 .../apache/maven/its/bootstrap/DownloadMojo.java   | 37 +++++++++++++++-------
 2 files changed, 29 insertions(+), 16 deletions(-)

diff --git a/core-it-suite/src/test/resources-filtered/bootstrap.txt 
b/core-it-suite/src/test/resources-filtered/bootstrap.txt
index 42b594424..3e58f0e63 100644
--- a/core-it-suite/src/test/resources-filtered/bootstrap.txt
+++ b/core-it-suite/src/test/resources-filtered/bootstrap.txt
@@ -19,8 +19,8 @@ org.apache.geronimo.specs:geronimo-jcdi_2.0_spec:1.3
 org.apache.groovy:groovy-ant:4.0.15
 org.apache.groovy:groovy:4.0.15
 org.apache.maven:maven-api-spi:4.0.0-alpha-8
-org.apache.maven:maven-api-model:4.0.0-alpha-8:mdo
-org.apache.maven.extensions:maven-extensions:41:pom
+org.apache.maven:maven-api-model:mdo:4.0.0-alpha-8
+org.apache.maven.extensions:maven-extensions:pom:41
 org.apache.maven.its.plugins.class-loader:dep-c:${project.version}
 
org.apache.maven.its.plugins:maven-it-plugin-active-collection:${project.version}
 org.apache.maven.its.plugins:maven-it-plugin-all:${project.version}
@@ -171,7 +171,7 @@ org.eclipse.aether:aether-spi:0.9.0.M2
 org.eclipse.sisu:org.eclipse.sisu.inject:0.0.0.M5
 org.eclipse.sisu:org.eclipse.sisu.plexus:0.0.0.M5
 org.eclipse.sisu:sisu-maven-plugin:0.3.5
-org.junit:junit-bom:5.9.1:pom
+org.junit:junit-bom:pom:5.9.1
 org.junit.jupiter:junit-jupiter:5.9.1
 org.junit.jupiter:junit-jupiter-engine:5.9.1
 org.junit.platform:junit-platform-launcher:1.9.1
@@ -180,4 +180,4 @@ org.ow2.asm:asm:6.2
 org.ow2.asm:asm:7.2
 org.slf4j:slf4j-api:1.6.1
 org.slf4j:slf4j-api:1.7.36
-org.sonatype.sisu:sisu-guice:3.1.0:jar:no_aop
+org.sonatype.sisu:sisu-guice:jar:no_aop:3.1.0
diff --git 
a/core-it-support/maven-it-plugin-bootstrap/src/main/java/org/apache/maven/its/bootstrap/DownloadMojo.java
 
b/core-it-support/maven-it-plugin-bootstrap/src/main/java/org/apache/maven/its/bootstrap/DownloadMojo.java
index 241a68057..0e92c16f5 100644
--- 
a/core-it-support/maven-it-plugin-bootstrap/src/main/java/org/apache/maven/its/bootstrap/DownloadMojo.java
+++ 
b/core-it-support/maven-it-plugin-bootstrap/src/main/java/org/apache/maven/its/bootstrap/DownloadMojo.java
@@ -123,18 +123,31 @@ public class DownloadMojo extends AbstractMojo {
     static Dependency toDependency(String artifact) throws 
MojoFailureException {
         Dependency coordinate = new Dependency();
         String[] tokens = artifact.split(":");
-        if (tokens.length < 3 || tokens.length > 5) {
-            throw new MojoFailureException("Invalid artifact, you must specify 
"
-                    + "groupId:artifactId:version[:packaging[:classifier]] " + 
artifact);
-        }
-        coordinate.setGroupId(tokens[0]);
-        coordinate.setArtifactId(tokens[1]);
-        coordinate.setVersion(tokens[2]);
-        if (tokens.length >= 4) {
-            coordinate.setType(tokens[3]);
-        }
-        if (tokens.length == 5) {
-            coordinate.setClassifier(tokens[4]);
+        switch (tokens.length) {
+            case 3:
+                // groupId:artifactId:version
+                coordinate.setGroupId(tokens[0]);
+                coordinate.setArtifactId(tokens[1]);
+                coordinate.setVersion(tokens[2]);
+                break;
+            case 4:
+                // groupId:artifactId:type:version
+                coordinate.setGroupId(tokens[0]);
+                coordinate.setArtifactId(tokens[1]);
+                coordinate.setType(tokens[2]);
+                coordinate.setVersion(tokens[3]);
+                break;
+            case 5:
+                // groupId:artifactId:type:classifier:version
+                coordinate.setGroupId(tokens[0]);
+                coordinate.setArtifactId(tokens[1]);
+                coordinate.setType(tokens[2]);
+                coordinate.setClassifier(tokens[3]);
+                coordinate.setVersion(tokens[4]);
+                break;
+            default:
+                throw new MojoFailureException("Invalid artifact, you must 
specify "
+                        + "groupId:artifactId[:packaging[:classifier]]:version 
" + artifact);
         }
         return coordinate;
     }

Reply via email to