diff --git a/src/it/MINVOKER-330-realative-mavenExacutable/pom.xml b/src/it/MINVOKER-330-realative-mavenExacutable/pom.xml new file mode 100644 index 00000000..ae7d2cac --- /dev/null +++ b/src/it/MINVOKER-330-realative-mavenExacutable/pom.xml @@ -0,0 +1,60 @@ + + + + + + 4.0.0 + + org.apache.maven.plugins.invoker.its + minvoker-330 + 1.0-SNAPSHOT + pom + + + Test to check for usage of relative path in mavenExecutable. + + + + UTF-8 + + + + + + org.apache.maven.plugins + maven-invoker-plugin + @project.version@ + + + integration-test + initialize + + run + + + + + mvn + + + + + + diff --git a/src/it/MINVOKER-330-realative-mavenExacutable/src/it/project/pom.xml b/src/it/MINVOKER-330-realative-mavenExacutable/src/it/project/pom.xml new file mode 100644 index 00000000..e83b4293 --- /dev/null +++ b/src/it/MINVOKER-330-realative-mavenExacutable/src/it/project/pom.xml @@ -0,0 +1,28 @@ + + + + + + 4.0.0 + org.apache.maven.plugins.invoker.its + minvoker-330 + 0.1-SNAPSHOT + pom + diff --git a/src/main/java/org/apache/maven/plugins/invoker/AbstractInvokerMojo.java b/src/main/java/org/apache/maven/plugins/invoker/AbstractInvokerMojo.java index 4a3bd354..84bf5b79 100644 --- a/src/main/java/org/apache/maven/plugins/invoker/AbstractInvokerMojo.java +++ b/src/main/java/org/apache/maven/plugins/invoker/AbstractInvokerMojo.java @@ -429,7 +429,7 @@ public abstract class AbstractInvokerMojo extends AbstractMojo { * @since 1.8 */ @Parameter(property = "invoker.mavenExecutable") - private File mavenExecutable; + private String mavenExecutable; /** * The JAVA_HOME environment variable to use for forked Maven invocations. Defaults to the current Java diff --git a/src/main/java/org/apache/maven/plugins/invoker/InvokerProperties.java b/src/main/java/org/apache/maven/plugins/invoker/InvokerProperties.java index 08721a0f..5901ad58 100644 --- a/src/main/java/org/apache/maven/plugins/invoker/InvokerProperties.java +++ b/src/main/java/org/apache/maven/plugins/invoker/InvokerProperties.java @@ -153,8 +153,10 @@ public void setDefaultProfiles(List defaultProfiles) { * Default value for mavenExecutable * @param defaultMavenExecutable a default value */ - public void setDefaultMavenExecutable(File defaultMavenExecutable) { - this.defaultMavenExecutable = defaultMavenExecutable; + public void setDefaultMavenExecutable(String defaultMavenExecutable) { + if (StringUtils.isNotBlank(defaultMavenExecutable)) { + this.defaultMavenExecutable = new File(defaultMavenExecutable); + } } /** diff --git a/src/test/java/org/apache/maven/plugins/invoker/InvokerPropertiesTest.java b/src/test/java/org/apache/maven/plugins/invoker/InvokerPropertiesTest.java index 2ba1d78c..8db6c396 100644 --- a/src/test/java/org/apache/maven/plugins/invoker/InvokerPropertiesTest.java +++ b/src/test/java/org/apache/maven/plugins/invoker/InvokerPropertiesTest.java @@ -216,7 +216,7 @@ public void testConfigureRequestMavenExecutable() { InvokerProperties facade = new InvokerProperties(props); File aDefExecutable = new File("defExecutable"); - facade.setDefaultMavenExecutable(aDefExecutable); + facade.setDefaultMavenExecutable(aDefExecutable.toString()); props.setProperty("invoker.mavenExecutable", "aPropExecutable"); facade.configureInvocation(request, 0);