diff --git a/README.md b/README.md index 8fe36ddd..bc4f82a0 100644 --- a/README.md +++ b/README.md @@ -8,7 +8,17 @@ This is the [exec-maven-plugin](http://www.mojohaus.org/exec-maven-plugin/). ## Running integration tests -Execute `mvn -P run-its clean verify` +Execute + +```sh +mvn -P run-its clean verify +``` + +Running a single test: + +```sh +mvn -P run-its clean verify "-Dinvoker.test=setup-parent," +``` ## Releasing diff --git a/src/it/projects/custom-plugin-repository/build-dependency/pom.xml b/src/it/projects/custom-plugin-repository/build-dependency/pom.xml new file mode 100644 index 00000000..e289a804 --- /dev/null +++ b/src/it/projects/custom-plugin-repository/build-dependency/pom.xml @@ -0,0 +1,39 @@ + + + 4.0.0 + + + org.codehaus.mojo.exec.it + parent + 0.1 + + + + custom-plugin-repository-build + 0.0.1-SNAPSHOT + + Builds a JAR and installs it into a custom local Maven repository + + + + + + org.apache.maven.plugins + maven-install-plugin + + + package + + install-file + + + ${project.build.directory}/${project.build.finalName}.jar + ${project.basedir}/../custom-repo + + + + + + + diff --git a/src/it/projects/custom-plugin-repository/build-dependency/src/main/java/example/Main.java b/src/it/projects/custom-plugin-repository/build-dependency/src/main/java/example/Main.java new file mode 100644 index 00000000..9fe87e81 --- /dev/null +++ b/src/it/projects/custom-plugin-repository/build-dependency/src/main/java/example/Main.java @@ -0,0 +1,8 @@ +package example; + +public class Main +{ + public static void main( String[] args ) throws Exception { + System.out.println( "Can you hear me, Major Tom?" ); + } +} diff --git a/src/it/projects/custom-plugin-repository/invoker.properties b/src/it/projects/custom-plugin-repository/invoker.properties new file mode 100644 index 00000000..f46ac97b --- /dev/null +++ b/src/it/projects/custom-plugin-repository/invoker.properties @@ -0,0 +1,6 @@ +# First build and install dependency in custom repo +invoker.project.1 = build-dependency +invoker.goals.1 = clean package + +# Then try to use dependency from custom repo +invoker.goals.2 = clean process-resources diff --git a/src/it/projects/custom-plugin-repository/pom.xml b/src/it/projects/custom-plugin-repository/pom.xml new file mode 100644 index 00000000..7088f926 --- /dev/null +++ b/src/it/projects/custom-plugin-repository/pom.xml @@ -0,0 +1,66 @@ + + + 4.0.0 + + + org.codehaus.mojo.exec.it + parent + 0.1 + + + custom-plugin-repository-use + 0.0.1-SNAPSHOT + + Tests executing a JAR which only exists in a custom Maven repository but not in Central + + + + + custom-repo + + file:///${project.basedir}/custom-repo + + true + + ignore + + + + + + + + org.codehaus.mojo + exec-maven-plugin + @project.version@ + + + process-resources + + java + + + + + false + false + true + + org.codehaus.mojo.exec.it + custom-plugin-repository-build + + example.Main + + + + org.codehaus.mojo.exec.it + custom-plugin-repository-build + 0.0.1-SNAPSHOT + + + + + + diff --git a/src/it/projects/custom-plugin-repository/verify.groovy b/src/it/projects/custom-plugin-repository/verify.groovy new file mode 100644 index 00000000..5d1e2f40 --- /dev/null +++ b/src/it/projects/custom-plugin-repository/verify.groovy @@ -0,0 +1,24 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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. + */ + +File buildLog = new File(basedir, 'build.log') +assert buildLog.exists() +def buildLogText = buildLog.getText() +// Should contain program output +assert buildLogText.contains('Can you hear me, Major Tom?') diff --git a/src/main/java/org/codehaus/mojo/exec/AbstractExecMojo.java b/src/main/java/org/codehaus/mojo/exec/AbstractExecMojo.java index b5134e81..c50dfdfa 100644 --- a/src/main/java/org/codehaus/mojo/exec/AbstractExecMojo.java +++ b/src/main/java/org/codehaus/mojo/exec/AbstractExecMojo.java @@ -341,7 +341,7 @@ private Set resolveExecutablePluginDependencies(Artifact executableArt try { CollectRequest collectRequest = new CollectRequest(); collectRequest.setRoot(new Dependency(RepositoryUtils.toArtifact(executableArtifact), classpathScope)); - // as this method is called only determineRelevantPluginDependencies, se we need a plugin repository here + // this method is called only by determineRelevantPluginDependencies, so we need a plugin repository here collectRequest.setRepositories(project.getRemotePluginRepositories()); DependencyFilter classpathFilter = DependencyFilterUtils.classpathFilter(classpathScope);