getManagedDependencies(MavenProject project) {
}
public String toCoordinate(Dependency d) {
- StringBuffer sb = new StringBuffer().append(d.getGroupId()).append(":").append(d.getArtifactId()).append(":").append(d.getType());
- if (d.getClassifier() != null && d.getClassifier().isEmpty() == false) {
+ StringBuilder sb = new StringBuilder().append(d.getGroupId()).append(":").append(d.getArtifactId()).append(":").append(d.getType());
+ if (d.getClassifier() != null && !d.getClassifier().isEmpty()) {
sb.append(":").append(d.getClassifier());
}
sb.append(":").append(d.getVersion());
@@ -156,8 +156,8 @@ public String toCoordinate(Dependency d) {
}
public String toVersionlessCoordinate(Dependency d) {
- StringBuffer sb = new StringBuffer().append(d.getGroupId()).append(":").append(d.getArtifactId()).append(":").append(d.getType());
- if (d.getClassifier() != null && d.getClassifier().isEmpty() == false) {
+ StringBuilder sb = new StringBuilder().append(d.getGroupId()).append(":").append(d.getArtifactId()).append(":").append(d.getType());
+ if (d.getClassifier() != null && !d.getClassifier().isEmpty()) {
sb.append(":").append(d.getClassifier());
}
return sb.toString();
@@ -165,8 +165,6 @@ public String toVersionlessCoordinate(Dependency d) {
public String toVersionlessCoordinate(MavenProject project) {
String extension = artifactHandlerManager.getArtifactHandler(project.getPackaging()).getExtension();
- StringBuffer sb = new StringBuffer().append(project.getGroupId()).append(":").append(project.getArtifactId()).append(":").append(extension);
- return sb.toString();
+ return project.getGroupId() + ":" + project.getArtifactId() + ":" + extension;
}
-
}
diff --git a/provisio-maven-plugin/src/main/java/ca/vanzyl/maven/plugins/provisio/ProvisioningMojo.java b/provisio-maven-plugin/src/main/java/ca/vanzyl/maven/plugins/provisio/ProvisioningMojo.java
index a42ae2e..5387232 100644
--- a/provisio-maven-plugin/src/main/java/ca/vanzyl/maven/plugins/provisio/ProvisioningMojo.java
+++ b/provisio-maven-plugin/src/main/java/ca/vanzyl/maven/plugins/provisio/ProvisioningMojo.java
@@ -24,7 +24,6 @@
import ca.vanzyl.provisio.model.ProvisioningResult;
import ca.vanzyl.provisio.model.Runtime;
import org.apache.maven.plugin.MojoExecutionException;
-import org.apache.maven.plugin.MojoFailureException;
import org.apache.maven.plugins.annotations.LifecyclePhase;
import org.apache.maven.plugins.annotations.Mojo;
import org.apache.maven.plugins.annotations.Parameter;
@@ -41,6 +40,7 @@ public class ProvisioningMojo extends BaseMojo {
@Parameter(defaultValue = "${project.build.directory}/${project.artifactId}-${project.version}")
private File outputDirectory;
+ @Override
public void execute() throws MojoExecutionException {
if (skipProvision) {
getLog().info("Skipping provision");
diff --git a/provisio-maven-plugin/src/main/java/ca/vanzyl/maven/plugins/provisio/ValidatorMojo.java b/provisio-maven-plugin/src/main/java/ca/vanzyl/maven/plugins/provisio/ValidatorMojo.java
index 4cef34a..94e662a 100644
--- a/provisio-maven-plugin/src/main/java/ca/vanzyl/maven/plugins/provisio/ValidatorMojo.java
+++ b/provisio-maven-plugin/src/main/java/ca/vanzyl/maven/plugins/provisio/ValidatorMojo.java
@@ -44,6 +44,7 @@ public class ValidatorMojo
@Parameter(required = true, property = "pomFile", defaultValue = "${basedir}/pom.xml")
private File pomFile;
+ @Override
public void execute()
throws MojoExecutionException, MojoFailureException
{
diff --git a/provisio-maven-plugin/src/test/java/ca/vanzyl/maven/plugins/provisio/GeneratorIntegrationTest.java b/provisio-maven-plugin/src/test/java/ca/vanzyl/maven/plugins/provisio/GeneratorIntegrationTest.java
index 0a8a01b..a151e54 100644
--- a/provisio-maven-plugin/src/test/java/ca/vanzyl/maven/plugins/provisio/GeneratorIntegrationTest.java
+++ b/provisio-maven-plugin/src/test/java/ca/vanzyl/maven/plugins/provisio/GeneratorIntegrationTest.java
@@ -41,7 +41,7 @@
import static org.junit.Assert.assertArrayEquals;
@RunWith(MavenJUnitTestRunner.class)
-@MavenVersions({"3.6.3", "3.8.4"})
+@MavenVersions({"3.6.3", "3.8.8", "3.9.6"})
@SuppressWarnings({"JUnitTestNG", "PublicField"})
public class GeneratorIntegrationTest
{
diff --git a/provisio-maven-plugin/src/test/java/ca/vanzyl/maven/plugins/provisio/ProvisioningIntegrationTest.java b/provisio-maven-plugin/src/test/java/ca/vanzyl/maven/plugins/provisio/ProvisioningIntegrationTest.java
new file mode 100644
index 0000000..7091152
--- /dev/null
+++ b/provisio-maven-plugin/src/test/java/ca/vanzyl/maven/plugins/provisio/ProvisioningIntegrationTest.java
@@ -0,0 +1,60 @@
+/**
+ * Copyright (C) 2015-2020 Jason van Zyl
+ *
+ * Licensed 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.
+ */
+package ca.vanzyl.maven.plugins.provisio;
+
+import io.takari.maven.testing.TestResources;
+import io.takari.maven.testing.executor.MavenRuntime;
+import io.takari.maven.testing.executor.MavenRuntime.MavenRuntimeBuilder;
+import io.takari.maven.testing.executor.MavenVersions;
+import io.takari.maven.testing.executor.junit.MavenJUnitTestRunner;
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+import java.io.File;
+
+import static org.junit.Assert.assertTrue;
+
+@RunWith(MavenJUnitTestRunner.class)
+@MavenVersions({"3.6.3", "3.8.8", "3.9.6"})
+@SuppressWarnings({"JUnitTestNG", "PublicField"})
+public class ProvisioningIntegrationTest
+{
+ @Rule
+ public final TestResources resources = new TestResources();
+
+ public final MavenRuntime maven;
+
+ public ProvisioningIntegrationTest(MavenRuntimeBuilder mavenBuilder)
+ throws Exception
+ {
+ this.maven = mavenBuilder.withCliOptions("-B", "-U").build();
+ }
+
+ @Test
+ public void testTransitiveWithLocalTestScope()
+ throws Exception
+ {
+ File basedir = resources.getBasedir("transitive-test");
+ maven.forProject(basedir)
+ .execute("provisio:provision")
+ .assertErrorFreeLog();
+
+ File libdir = new File(basedir, "target/test-1.0/lib");
+ assertTrue("guice exists", new File(libdir, "guice-7.0.0.jar").isFile());
+ assertTrue("guava exists", new File(libdir, "guava-31.0.1-jre.jar").isFile());
+ }
+}
diff --git a/provisio-maven-plugin/src/test/java/ca/vanzyl/maven/plugins/provisio/ValidatorIntegrationTest.java b/provisio-maven-plugin/src/test/java/ca/vanzyl/maven/plugins/provisio/ValidatorIntegrationTest.java
index 399d946..003da68 100644
--- a/provisio-maven-plugin/src/test/java/ca/vanzyl/maven/plugins/provisio/ValidatorIntegrationTest.java
+++ b/provisio-maven-plugin/src/test/java/ca/vanzyl/maven/plugins/provisio/ValidatorIntegrationTest.java
@@ -27,7 +27,7 @@
import java.io.File;
@RunWith(MavenJUnitTestRunner.class)
-@MavenVersions({"3.6.3", "3.8.4"})
+@MavenVersions({"3.6.3", "3.8.8", "3.9.6"})
@SuppressWarnings({"JUnitTestNG", "PublicField"})
public class ValidatorIntegrationTest
{
diff --git a/provisio-maven-plugin/src/test/projects/transitive-test/pom.xml b/provisio-maven-plugin/src/test/projects/transitive-test/pom.xml
new file mode 100644
index 0000000..05cad66
--- /dev/null
+++ b/provisio-maven-plugin/src/test/projects/transitive-test/pom.xml
@@ -0,0 +1,37 @@
+
+
+ 4.0.0
+ ca.vanzyl.provisio.maven.plugins.its
+ test
+ 1.0
+ provisio
+
+
+ UTF-8
+
+
+
+
+ com.google.inject
+ guice
+ 7.0.0
+
+
+ com.google.guava
+ guava
+ 31.0.1-jre
+ test
+
+
+
+
+
+
+ ca.vanzyl.provisio.maven.plugins
+ provisio-maven-plugin
+ ${it-plugin.version}
+ true
+
+
+
+
diff --git a/provisio-maven-plugin/src/test/projects/transitive-test/src/main/provisio/provisio.xml b/provisio-maven-plugin/src/test/projects/transitive-test/src/main/provisio/provisio.xml
new file mode 100644
index 0000000..05d7faa
--- /dev/null
+++ b/provisio-maven-plugin/src/test/projects/transitive-test/src/main/provisio/provisio.xml
@@ -0,0 +1,3 @@
+
+
+