diff -Nru exec-maven-plugin-1.1.1+dfsg/appveyor.yml exec-maven-plugin-1.6.0/appveyor.yml --- exec-maven-plugin-1.1.1+dfsg/appveyor.yml 1970-01-01 00:00:00.000000000 +0000 +++ exec-maven-plugin-1.6.0/appveyor.yml 2017-03-02 20:58:24.000000000 +0000 @@ -0,0 +1,24 @@ +version: '{build}' +skip_tags: true +clone_depth: 10 +environment: + matrix: + - JAVA_HOME: C:\Program Files\Java\jdk1.7.0 + - JAVA_HOME: C:\Program Files\Java\jdk1.8.0 + +install: + - ps: | + Add-Type -AssemblyName System.IO.Compression.FileSystem + if (!(Test-Path -Path "C:\maven" )) { + (new-object System.Net.WebClient).DownloadFile('https://repo1.maven.org/maven2/org/apache/maven/apache-maven/3.3.9/apache-maven-3.3.9-bin.zip', 'C:\maven-bin.zip') + [System.IO.Compression.ZipFile]::ExtractToDirectory("C:\maven-bin.zip", "C:\maven") + } +# Prepend Java entry, remove Ruby entry (C:\Ruby193\bin;) from PATH + - cmd: SET PATH=C:\maven\apache-maven-3.3.9\bin;%JAVA_HOME%\bin;%PATH:C:\Ruby193\bin;=% + - cmd: SET MAVEN_OPTS=-Xmx768m + - cmd: mvn --version + - cmd: java -version +build_script: + - mvn -B -Prun-its clean verify +cache: + - C:\Users\appveyor\.m2 diff -Nru exec-maven-plugin-1.1.1+dfsg/debian/changelog exec-maven-plugin-1.6.0/debian/changelog --- exec-maven-plugin-1.1.1+dfsg/debian/changelog 2011-09-12 18:36:08.000000000 +0000 +++ exec-maven-plugin-1.6.0/debian/changelog 2021-04-20 00:52:55.000000000 +0000 @@ -1,3 +1,61 @@ +exec-maven-plugin (1.6.0-4~16.04.sav0) xenial; urgency=medium + + * Backport to Xenial + + -- Rob Savoury Mon, 19 Apr 2021 17:52:55 -0700 + +exec-maven-plugin (1.6.0-4) unstable; urgency=medium + + * Team upload. + * Depend on libplexus-component-metadata-java + instead of libplexus-containers1.5-java + + -- Emmanuel Bourg Wed, 06 Sep 2017 08:43:28 +0200 + +exec-maven-plugin (1.6.0-3) unstable; urgency=medium + + * Team upload. + * Declare that libexec-maven-plugin-java breaks/replaces (and not conflicts) + libmaven-exec-plugin-java (<< 1.6.0) + + -- Emmanuel Bourg Tue, 05 Sep 2017 17:44:39 +0200 + +exec-maven-plugin (1.6.0-2) unstable; urgency=medium + + * Team upload. + * Added the missing Maven rule for plexus-component-annotations + + -- Emmanuel Bourg Tue, 05 Sep 2017 08:11:23 +0200 + +exec-maven-plugin (1.6.0-1) unstable; urgency=medium + + * Team upload. + + [ Emmanuel Bourg ] + * New upstream release + - Refreshed the patches + - New dependency on libcommons-exec-java + - New build dependency on junit4 + * Depend on libmaven3-core-java instead of libmaven2-core-java + * Build with the DH sequencer instead of CDBS + * Standards-Version updated to 4.0.0 + * Use secure Vcs-* URLs + * Updated the Homepage field + * Track and download the new releases from GitHub + + [ Andres Mejia ] + * Recreate packaging using mh_make. + * Rename package libmaven-exec-plugin-java to libexec-maven-plugin-java. + + [ Gabriele Giacone ] + * Make VCS-* fields canonical. + + [ tony mancill ] + * Remove Gabriele Giacone from Uploaders (Closes: #856740) + * Use debhelper 10 + + -- Emmanuel Bourg Wed, 26 Jul 2017 10:54:16 +0200 + exec-maven-plugin (1.1.1+dfsg-3) unstable; urgency=low * Team upload. diff -Nru exec-maven-plugin-1.1.1+dfsg/debian/compat exec-maven-plugin-1.6.0/debian/compat --- exec-maven-plugin-1.1.1+dfsg/debian/compat 2011-09-12 18:36:08.000000000 +0000 +++ exec-maven-plugin-1.6.0/debian/compat 2017-07-25 22:54:24.000000000 +0000 @@ -1 +1 @@ -7 +10 diff -Nru exec-maven-plugin-1.1.1+dfsg/debian/control exec-maven-plugin-1.6.0/debian/control --- exec-maven-plugin-1.1.1+dfsg/debian/control 2011-09-12 18:36:08.000000000 +0000 +++ exec-maven-plugin-1.6.0/debian/control 2017-09-06 06:42:49.000000000 +0000 @@ -2,21 +2,44 @@ Section: java Priority: optional Maintainer: Debian Java Maintainers -Uploaders: Gabriele Giacone <1o5g4r8o@gmail.com> -Build-Depends: debhelper (>= 7), cdbs -Build-Depends-Indep: default-jdk, maven-debian-helper, libmaven2-core-java, - libplexus-container-default-java, libplexus-utils-java, libmaven-plugin-testing-java, - libmaven-plugin-tools-java -Standards-Version: 3.9.2 -Vcs-Git: git://git.debian.org/git/pkg-java/exec-maven-plugin.git -Vcs-Browser: http://git.debian.org/?p=pkg-java/exec-maven-plugin.git;a=summary -Homepage: http://mojo.codehaus.org/exec-maven-plugin +Uploaders: tony mancill +Build-Depends: + debhelper (>= 10), + default-jdk, + junit4, + libcommons-exec-java, + libmaven-plugin-testing-java, + libmaven3-core-java, + libplexus-component-metadata-java, + libplexus-utils-java, + maven-debian-helper (>= 2.2) +Standards-Version: 4.0.0 +Vcs-Git: https://anonscm.debian.org/git/pkg-java/exec-maven-plugin.git +Vcs-Browser: https://anonscm.debian.org/cgit/pkg-java/exec-maven-plugin.git +Homepage: http://www.mojohaus.org/exec-maven-plugin/ -Package: libmaven-exec-plugin-java +Package: libexec-maven-plugin-java Architecture: all -Depends: ${misc:Depends}, ${maven:Depends} +Depends: ${maven:Depends}, ${misc:Depends} Recommends: ${maven:OptionalDepends} -Description: Maven Exec Plugin - The plugin provides 2 goals to help execute system and Java programs: - exec:exec, execute programs and Java programs in a separate process and - exec:java, execute Java programs in the same VM. +Provides: libmaven-exec-plugin-java +Replaces: libmaven-exec-plugin-java (<< 1.6.0) +Breaks: libmaven-exec-plugin-java (<< 1.6.0) +Description: Exec Maven Plugin + Maven plugin to allow execution of system and Java programs. + It provides two goals to help execute system and Java programs: + * exec:exec, execute programs and Java programs in a separate process + * exec:java, execute Java programs in the same VM. + +Package: libmaven-exec-plugin-java +Priority: extra +Section: oldlibs +Architecture: all +Depends: libexec-maven-plugin-java, ${misc:Depends} +Description: Exec Maven Plugin (transitional package) + Maven plugin to allow execution of system and Java programs. + It provides two goals to help execute system and Java programs: + * exec:exec, execute programs and Java programs in a separate process + * exec:java, execute Java programs in the same VM. + . + This is a dummy transitional package. It may be safely removed. diff -Nru exec-maven-plugin-1.1.1+dfsg/debian/copyright exec-maven-plugin-1.6.0/debian/copyright --- exec-maven-plugin-1.1.1+dfsg/debian/copyright 2011-09-12 18:36:08.000000000 +0000 +++ exec-maven-plugin-1.6.0/debian/copyright 2017-07-26 08:36:28.000000000 +0000 @@ -1,21 +1,20 @@ -Format-Specification: http://dep.debian.net/deps/dep5/ -Name: Exec Maven Plugin -Maintainer: The Codehaus -Source: http://mojo.codehaus.org/exec-maven-plugin +Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ +Upstream-Name: Exec Maven Plugin +Source: https://github.com/mojohaus/exec-maven-plugin +Files-Excluded: *.jar Files: * -Copyright: 2005-2009, The Codehaus +Copyright: 2005-2017, The Codehaus License: Apache-2.0 + On Debian systems, the full text of the Apache-2.0 license + can be found in the file '/usr/share/common-licenses/Apache-2.0' Files: debian/* -Copyright: 2009, Gabriele Giacone <1o5g4r8o@gmail.com> +Copyright: 2009-2014, Gabriele Giacone <1o5g4r8o@gmail.com> + 2011, Torsten Werner + 2013, Andres Mejia + 2017, tony mancill + 2017, Emmanuel Bourg License: GPL-3+ - -License: Apache-2.0 - On Debian GNU/Linux system you can find the complete text of the - Apache-2.0 license in '/usr/share/common-licenses/Apache-2.0' - -License: GPL-3 - On Debian GNU/Linux system you can find the complete text of the - GPL-3 license in '/usr/share/common-licenses/GPL-3' - + On Debian systems, the full text of the GPL-3 license + can be found in the file '/usr/share/common-licenses/GPL-3' diff -Nru exec-maven-plugin-1.1.1+dfsg/debian/libexec-maven-plugin-java.poms exec-maven-plugin-1.6.0/debian/libexec-maven-plugin-java.poms --- exec-maven-plugin-1.1.1+dfsg/debian/libexec-maven-plugin-java.poms 1970-01-01 00:00:00.000000000 +0000 +++ exec-maven-plugin-1.6.0/debian/libexec-maven-plugin-java.poms 2017-07-25 22:54:24.000000000 +0000 @@ -0,0 +1,28 @@ +# List of POM files for the package +# Format of this file is: +# [option]* +# where option can be: +# --ignore: ignore this POM and its artifact if any +# --ignore-pom: don't install the POM. To use on POM files that are created +# temporarily for certain artifacts such as Javadoc jars. [mh_install, mh_installpoms] +# --no-parent: remove the tag from the POM +# --package=: an alternative package to use when installing this POM +# and its artifact +# --has-package-version: to indicate that the original version of the POM is the same as the upstream part +# of the version for the package. +# --keep-elements=: a list of XML elements to keep in the POM +# during a clean operation with mh_cleanpom or mh_installpom +# --artifact=: path to the build artifact associated with this POM, +# it will be installed when using the command mh_install. [mh_install] +# --java-lib: install the jar into /usr/share/java to comply with Debian +# packaging guidelines +# --usj-name=: name to use when installing the library in /usr/share/java +# --usj-version=: version to use when installing the library in /usr/share/java +# --no-usj-versionless: don't install the versionless link in /usr/share/java +# --dest-jar=: the destination for the real jar. +# It will be installed with mh_install. [mh_install] +# --classifier=: Optional, the classifier for the jar. Empty by default. +# --site-xml=: Optional, the location for site.xml if it needs to be installed. +# Empty by default. [mh_install] +# +pom.xml --no-parent diff -Nru exec-maven-plugin-1.1.1+dfsg/debian/libmaven-exec-plugin-java.poms exec-maven-plugin-1.6.0/debian/libmaven-exec-plugin-java.poms --- exec-maven-plugin-1.1.1+dfsg/debian/libmaven-exec-plugin-java.poms 2011-09-12 18:36:08.000000000 +0000 +++ exec-maven-plugin-1.6.0/debian/libmaven-exec-plugin-java.poms 1970-01-01 00:00:00.000000000 +0000 @@ -1 +0,0 @@ -pom.xml --no-parent diff -Nru exec-maven-plugin-1.1.1+dfsg/debian/maven.ignoreRules exec-maven-plugin-1.6.0/debian/maven.ignoreRules --- exec-maven-plugin-1.1.1+dfsg/debian/maven.ignoreRules 1970-01-01 00:00:00.000000000 +0000 +++ exec-maven-plugin-1.6.0/debian/maven.ignoreRules 2017-07-26 07:11:39.000000000 +0000 @@ -0,0 +1,20 @@ +# Maven ignore rules - ignore some Maven dependencies and plugins +# Format of this file is: +# [group] [artifact] [type] [version] [classifier] [scope] +# where each element can be either +# - the exact string, for example org.apache for the group, or 3.1 +# for the version. In this case, the element is simply matched +# and left as it is +# - * (the star character, alone). In this case, anything will +# match and be left as it is. For example, using * on the +# position of the artifact field will match any artifact id +# All elements much match before a rule can be applied +# Example rule: match jar with groupid= junit, artifactid= junit +# and version starting with 3., this dependency is then removed +# from the POM +# junit junit jar s/3\..*/3.x/ + +org.codehaus.mojo animal-sniffer-maven-plugin +org.apache.maven maven-project +org.apache.maven maven-toolchain +org.apache.maven.plugins maven-plugin-plugin jar diff -Nru exec-maven-plugin-1.1.1+dfsg/debian/maven.rules exec-maven-plugin-1.6.0/debian/maven.rules --- exec-maven-plugin-1.1.1+dfsg/debian/maven.rules 2011-09-12 18:36:08.000000000 +0000 +++ exec-maven-plugin-1.6.0/debian/maven.rules 2017-09-05 15:01:41.000000000 +0000 @@ -1,5 +1,28 @@ -org.codehaus.plexus plexus-container-default jar s/1\.0-alpha.*/1.0-alpha/ * -s/org.apache.maven.shared/org.apache.maven.plugin-testing/ maven-plugin-testing * s/.*/debian/ * -s/org.apache.maven.shared/org.apache.maven.plugin-testing/ maven-plugin-testing-harness * s/.*/debian/ * -s/org.apache.maven.shared/org.apache.maven.plugin-testing/ maven-plugin-testing-tools * s/.*/debian/ * -s/org.apache.maven.shared/org.apache.maven.plugin-testing/ maven-test-tools * s/.*/debian/ * +# Maven rules - transform Maven dependencies and plugins +# Format of this file is: +# [group] [artifact] [type] [version] [classifier] [scope] +# where each element can be either +# - the exact string, for example org.apache for the group, or 3.1 +# for the version. In this case, the element is simply matched +# and left as it is +# - * (the star character, alone). In this case, anything will +# match and be left as it is. For example, using * on the +# position of the artifact field will match any artifact id +# - a regular expression of the form s/match/replace/ +# in this case, elements that match are transformed using +# the regex rule. +# All elements much match before a rule can be applied +# Example rule: match jar with groupid= junit, artifactid= junit +# and version starting with 3., replacing the version with 3.x +# junit junit jar s/3\..*/3.x/ + +org.codehaus.plexus plexus-container-default jar s/.*/1.5.5/ * * +org.codehaus.plexus plexus-component-annotations jar s/.*/1.5.5/ * * +org.codehaus.plexus plexus-component-metadata maven-plugin s/1.7/1.5.5/ * * +s/org.apache.maven.shared/org.apache.maven.plugin-testing/ maven-plugin-testing-harness * s/.*/debian/ * * +s/org.apache.maven.shared/org.apache.maven.plugin-testing/ maven-plugin-testing-tools * s/.*/debian/ * * +s/org.apache.maven.shared/org.apache.maven.plugin-testing/ maven-plugin-testing * s/.*/debian/ * * +s/org.apache.maven.shared/org.apache.maven.plugin-testing/ maven-test-tools * s/.*/debian/ * * +junit junit * s/.*/4.x/ * * +org.apache.maven maven-* * s/.*/3.x/ * * +org.apache.maven s/maven-artifact-manager/maven-compat/ * s/.*/3.x/ * * diff -Nru exec-maven-plugin-1.1.1+dfsg/debian/orig-tar.sh exec-maven-plugin-1.6.0/debian/orig-tar.sh --- exec-maven-plugin-1.1.1+dfsg/debian/orig-tar.sh 2011-09-12 18:36:08.000000000 +0000 +++ exec-maven-plugin-1.6.0/debian/orig-tar.sh 1970-01-01 00:00:00.000000000 +0000 @@ -1,17 +0,0 @@ -#!/bin/sh -e - -VERSION=$2 -TAR=../exec-maven-plugin_$VERSION.orig.tar.gz -DIR=exec-maven-plugin-$VERSION -TAG=$(echo "exec-maven-plugin-$VERSION" \ - | sed -re 's/~(alpha|beta)/-\1-/' -e 's/\+dfsg//') - -svn export http://svn.codehaus.org/mojo/tags/${TAG}/ $DIR -GZIP=--best tar -c -z -f $TAR --exclude '*.jar' --exclude '*.class' $DIR -rm -rf $DIR ../$TAG - -# move to directory 'tarballs' -if [ -r .svn/deb-layout ]; then - . .svn/deb-layout - mv $TAR $origDir && echo "moved $TAR to $origDir" -fi diff -Nru exec-maven-plugin-1.1.1+dfsg/debian/patches/00EnabledTests exec-maven-plugin-1.6.0/debian/patches/00EnabledTests --- exec-maven-plugin-1.1.1+dfsg/debian/patches/00EnabledTests 2011-09-12 18:36:08.000000000 +0000 +++ exec-maven-plugin-1.6.0/debian/patches/00EnabledTests 1970-01-01 00:00:00.000000000 +0000 @@ -1,187 +0,0 @@ -Description: Patches to execute build test using Debian maven repo -Author: Gabriele Giacone <1o5g4r8o@gmail.com> - ---- exec-maven-plugin-1.1.1.orig/src/test/java/org/codehaus/mojo/exec/ExecJavaMojoTest.java -+++ exec-maven-plugin-1.1.1/src/test/java/org/codehaus/mojo/exec/ExecJavaMojoTest.java -@@ -260,7 +260,7 @@ public class ExecJavaMojoTest - ArtifactRepositoryLayout localRepositoryLayout = - (ArtifactRepositoryLayout) lookup( ArtifactRepositoryLayout.ROLE, "default" ); - -- String path = "src/test/repository"; -+ String path = "debian/maven-repo"; - - ArtifactRepository localRepository = new DefaultArtifactRepository( "local", "file://" + - new File( path ).getAbsolutePath(), localRepositoryLayout ); ---- exec-maven-plugin-1.1.1.orig/src/test/java/org/codehaus/mojo/exec/ExecMojoTest.java -+++ exec-maven-plugin-1.1.1/src/test/java/org/codehaus/mojo/exec/ExecMojoTest.java -@@ -243,7 +243,7 @@ public class ExecMojoTest - ArtifactRepositoryLayout localRepositoryLayout = - (ArtifactRepositoryLayout) lookup( ArtifactRepositoryLayout.ROLE, "default" ); - -- String path = "src/test/repository"; -+ String path = "debian/maven-repo"; - - ArtifactRepository localRepository = new DefaultArtifactRepository( "local", "file://" + - new File( path ).getAbsolutePath(), localRepositoryLayout ); ---- exec-maven-plugin-1.1.1.orig/src/test/projects/project12/pom.xml -+++ exec-maven-plugin-1.1.1/src/test/projects/project12/pom.xml -@@ -32,12 +32,12 @@ - - commons-io - commons-io -- 1.1 -+ debian - - - commons-logging - commons-logging -- 1.0.4 -+ debian - - - ---- exec-maven-plugin-1.1.1.orig/src/test/projects/project13/pom.xml -+++ exec-maven-plugin-1.1.1/src/test/projects/project13/pom.xml -@@ -34,17 +34,17 @@ - - commons-io - commons-io -- 1.1 -+ debian - - - commons-logging - commons-logging -- 1.0.4 -+ debian - - - junit - junit -- 3.8.1 -+ debian - test - - ---- exec-maven-plugin-1.1.1.orig/src/test/projects/project2/pom.xml -+++ exec-maven-plugin-1.1.1/src/test/projects/project2/pom.xml -@@ -12,18 +12,18 @@ - - log4j - log4j -- 1.2.9 -+ debian - - - commons-io - commons-io -- 1.1 -+ debian - runtime - - - junit - junit -- 3.8.1 -+ debian - test - - ---- exec-maven-plugin-1.1.1.orig/src/test/projects/project1/pom.xml -+++ exec-maven-plugin-1.1.1/src/test/projects/project1/pom.xml -@@ -32,12 +32,12 @@ - - commons-io - commons-io -- 1.1 -+ debian - - - commons-logging - commons-logging -- 1.0.4 -+ debian - - - ---- exec-maven-plugin-1.1.1.orig/src/test/projects/project6/pom.xml -+++ exec-maven-plugin-1.1.1/src/test/projects/project6/pom.xml -@@ -10,7 +10,7 @@ - - junit - junit -- 3.8.1 -+ debian - - - ---- exec-maven-plugin-1.1.1.orig/src/test/projects/project6/project5lib/pom.xml -+++ exec-maven-plugin-1.1.1/src/test/projects/project6/project5lib/pom.xml -@@ -15,18 +15,18 @@ - - log4j - log4j -- 1.2.9 -+ debian - - - commons-io - commons-io -- 1.1 -+ debian - runtime - - - junit - junit -- 3.8.1 -+ debian - test - - ---- exec-maven-plugin-1.1.1.orig/src/test/projects/project3/pom.xml -+++ exec-maven-plugin-1.1.1/src/test/projects/project3/pom.xml -@@ -32,17 +32,17 @@ - - commons-io - commons-io -- 1.1 -+ debian - - - commons-logging - commons-logging -- 1.0.4 -+ debian - - - commons-lang - commons-lang -- 1.0.1 -+ debian - - - ---- exec-maven-plugin-1.1.1.orig/src/test/projects/project14/pom.xml -+++ exec-maven-plugin-1.1.1/src/test/projects/project14/pom.xml -@@ -34,17 +34,17 @@ - - commons-io - commons-io -- 1.1 -+ debian - - - commons-logging - commons-logging -- 1.0.4 -+ debian - - - junit - junit -- 3.8.1 -+ debian - test - - diff -Nru exec-maven-plugin-1.1.1+dfsg/debian/patches/junit-dependency.patch exec-maven-plugin-1.6.0/debian/patches/junit-dependency.patch --- exec-maven-plugin-1.1.1+dfsg/debian/patches/junit-dependency.patch 1970-01-01 00:00:00.000000000 +0000 +++ exec-maven-plugin-1.6.0/debian/patches/junit-dependency.patch 2017-07-26 07:21:19.000000000 +0000 @@ -0,0 +1,19 @@ +Description: Adds the missing dependency on junit (should be inherited from the parent pom) +Author: Emmanuel Bourg +Forwarded: not-needed +--- a/pom.xml ++++ b/pom.xml +@@ -181,7 +181,12 @@ + 1.21 + test + +- ++ ++ junit ++ junit ++ 4.12 ++ test ++ + + + diff -Nru exec-maven-plugin-1.1.1+dfsg/debian/patches/maven-compatibility.patch exec-maven-plugin-1.6.0/debian/patches/maven-compatibility.patch --- exec-maven-plugin-1.1.1+dfsg/debian/patches/maven-compatibility.patch 1970-01-01 00:00:00.000000000 +0000 +++ exec-maven-plugin-1.6.0/debian/patches/maven-compatibility.patch 2017-07-26 07:24:29.000000000 +0000 @@ -0,0 +1,39 @@ +Description: Fixes the compatibility with the version of Maven in Debian +Author: Emmanuel Bourg +Forwarded: no +--- a/src/test/java/org/codehaus/mojo/exec/ExecJavaMojoTest.java ++++ b/src/test/java/org/codehaus/mojo/exec/ExecJavaMojoTest.java +@@ -277,7 +277,7 @@ + private void setUpProject( File pomFile, AbstractMojo mojo ) + throws Exception + { +- MavenProjectBuilder builder = (MavenProjectBuilder) lookup( MavenProjectBuilder.ROLE ); ++ MavenProjectBuilder builder = (MavenProjectBuilder) lookup( MavenProjectBuilder.class.getName() ); + + ArtifactRepositoryLayout localRepositoryLayout = + (ArtifactRepositoryLayout) lookup( ArtifactRepositoryLayout.ROLE, "default" ); +--- a/src/test/java/org/codehaus/mojo/exec/ExecMojoTest.java ++++ b/src/test/java/org/codehaus/mojo/exec/ExecMojoTest.java +@@ -233,7 +233,7 @@ + private void setUpProject( File pomFile, ExecMojo mojo ) + throws Exception + { +- MavenProjectBuilder builder = (MavenProjectBuilder) lookup( MavenProjectBuilder.ROLE ); ++ MavenProjectBuilder builder = (MavenProjectBuilder) lookup( MavenProjectBuilder.class.getName() ); + + ArtifactRepositoryLayout localRepositoryLayout = + (ArtifactRepositoryLayout) lookup( ArtifactRepositoryLayout.ROLE, "default" ); +--- a/src/main/java/org/codehaus/mojo/exec/ExecJavaMojo.java ++++ b/src/main/java/org/codehaus/mojo/exec/ExecJavaMojo.java +@@ -704,9 +704,9 @@ + // resolve all dependencies transitively to obtain a comprehensive list of assemblies + ArtifactResolutionResult result = + artifactResolver.resolveTransitively( dependencyArtifacts, executablePomArtifact, +- Collections.emptyMap(), this.localRepository, ++ Collections.emptyMap(), this.localRepository, + this.remoteRepositories, metadataSource, null, +- Collections.emptyList() ); ++ Collections.emptyList() ); + executableDependencies = result.getArtifacts(); + } + catch ( Exception ex ) diff -Nru exec-maven-plugin-1.1.1+dfsg/debian/patches/series exec-maven-plugin-1.6.0/debian/patches/series --- exec-maven-plugin-1.1.1+dfsg/debian/patches/series 2011-09-12 18:36:08.000000000 +0000 +++ exec-maven-plugin-1.6.0/debian/patches/series 2017-07-26 06:54:49.000000000 +0000 @@ -1 +1,3 @@ -00EnabledTests +tests-local-repository.patch +junit-dependency.patch +maven-compatibility.patch diff -Nru exec-maven-plugin-1.1.1+dfsg/debian/patches/tests-local-repository.patch exec-maven-plugin-1.6.0/debian/patches/tests-local-repository.patch --- exec-maven-plugin-1.1.1+dfsg/debian/patches/tests-local-repository.patch 1970-01-01 00:00:00.000000000 +0000 +++ exec-maven-plugin-1.6.0/debian/patches/tests-local-repository.patch 2017-07-26 07:24:24.000000000 +0000 @@ -0,0 +1,171 @@ +Description: Patch to use Debian repository for tests. +Origin: debian +Forwarded: not-needed + +--- a/src/test/projects/project6/pom.xml ++++ b/src/test/projects/project6/pom.xml +@@ -10,7 +10,7 @@ + + junit + junit +- 3.8.1 ++ debian + + + +--- a/src/test/projects/project6/project5lib/pom.xml ++++ b/src/test/projects/project6/project5lib/pom.xml +@@ -15,18 +15,18 @@ + + log4j + log4j +- 1.2.9 ++ debian + + + commons-io + commons-io +- 1.1 ++ debian + runtime + + + junit + junit +- 3.8.1 ++ debian + test + + +--- a/src/test/projects/project14/pom.xml ++++ b/src/test/projects/project14/pom.xml +@@ -34,17 +34,17 @@ + + commons-io + commons-io +- 1.1 ++ debian + + + commons-logging + commons-logging +- 1.0.4 ++ debian + + + junit + junit +- 3.8.1 ++ debian + test + + +--- a/src/test/projects/project13/pom.xml ++++ b/src/test/projects/project13/pom.xml +@@ -34,17 +34,17 @@ + + commons-io + commons-io +- 1.1 ++ debian + + + commons-logging + commons-logging +- 1.0.4 ++ debian + + + junit + junit +- 3.8.1 ++ debian + test + + +--- a/src/test/projects/project2/pom.xml ++++ b/src/test/projects/project2/pom.xml +@@ -12,18 +12,18 @@ + + log4j + log4j +- 1.2.9 ++ debian + + + commons-io + commons-io +- 1.1 ++ debian + runtime + + + junit + junit +- 3.8.1 ++ debian + test + + +--- a/src/test/projects/project3/pom.xml ++++ b/src/test/projects/project3/pom.xml +@@ -32,17 +32,17 @@ + + commons-io + commons-io +- 1.1 ++ debian + + + commons-logging + commons-logging +- 1.0.4 ++ debian + + + commons-lang + commons-lang +- 1.0.1 ++ debian + + + +--- a/src/test/projects/project1/pom.xml ++++ b/src/test/projects/project1/pom.xml +@@ -32,12 +32,12 @@ + + commons-io + commons-io +- 1.1 ++ debian + + + commons-logging + commons-logging +- 1.0.4 ++ debian + + + +--- a/src/test/java/org/codehaus/mojo/exec/ExecMojoTest.java ++++ b/src/test/java/org/codehaus/mojo/exec/ExecMojoTest.java +@@ -238,7 +238,7 @@ + ArtifactRepositoryLayout localRepositoryLayout = + (ArtifactRepositoryLayout) lookup( ArtifactRepositoryLayout.ROLE, "default" ); + +- String path = "src/test/repository"; ++ String path = "debian/maven-repo"; + + ArtifactRepository localRepository = + new DefaultArtifactRepository( "local", "file://" + new File( path ).getAbsolutePath(), +--- a/src/test/java/org/codehaus/mojo/exec/ExecJavaMojoTest.java ++++ b/src/test/java/org/codehaus/mojo/exec/ExecJavaMojoTest.java +@@ -282,7 +282,7 @@ + ArtifactRepositoryLayout localRepositoryLayout = + (ArtifactRepositoryLayout) lookup( ArtifactRepositoryLayout.ROLE, "default" ); + +- String path = "src/test/repository"; ++ String path = "debian/maven-repo"; + + ArtifactRepository localRepository = + new DefaultArtifactRepository( "local", "file://" + new File( path ).getAbsolutePath(), diff -Nru exec-maven-plugin-1.1.1+dfsg/debian/README.source exec-maven-plugin-1.6.0/debian/README.source --- exec-maven-plugin-1.1.1+dfsg/debian/README.source 2011-09-12 18:36:08.000000000 +0000 +++ exec-maven-plugin-1.6.0/debian/README.source 2017-07-26 08:37:01.000000000 +0000 @@ -7,9 +7,3 @@ The build system uses Maven but prevents it from downloading anything from the Internet, making the build compliant with the Debian policy. - -The following binary files have been removed from upstream tarball: - -src/test/repository/commons-io/commons-io/commons-io/1.1/commons-io-1.1.jar -src/test/repository/commons-io/commons-io/1.1/commons-io-1.1.jar - diff -Nru exec-maven-plugin-1.1.1+dfsg/debian/rules exec-maven-plugin-1.6.0/debian/rules --- exec-maven-plugin-1.1.1+dfsg/debian/rules 2011-09-12 18:36:08.000000000 +0000 +++ exec-maven-plugin-1.6.0/debian/rules 2017-07-25 22:54:24.000000000 +0000 @@ -1,9 +1,7 @@ #!/usr/bin/make -f -include /usr/share/cdbs/1/rules/debhelper.mk -include /usr/share/cdbs/1/class/maven.mk - -JAVA_HOME := /usr/lib/jvm/default-java +%: + dh $@ get-orig-source: - uscan --force-download --rename + uscan --download-current-version --force-download --rename diff -Nru exec-maven-plugin-1.1.1+dfsg/debian/watch exec-maven-plugin-1.6.0/debian/watch --- exec-maven-plugin-1.1.1+dfsg/debian/watch 2011-09-12 18:36:08.000000000 +0000 +++ exec-maven-plugin-1.6.0/debian/watch 2017-07-25 22:54:24.000000000 +0000 @@ -1,5 +1,3 @@ version=3 -opts="uversionmangle=s/-(alpha|beta)-/~$1/,\ -dversionmangle=s/\+dfsg//" \ - http://svn.codehaus.org/mojo/tags/ \ - exec-maven-plugin-(\d.*)/ debian debian/orig-tar.sh +opts="mode=git,repack,compression=xz,uversionmangle=s/-(alpha|beta)-/~$1/,dversionmangle=s/[+]dfsg//" \ +https://github.com/mojohaus/exec-maven-plugin refs/tags/exec-maven-plugin-([\d\.]+) diff -Nru exec-maven-plugin-1.1.1+dfsg/.gitignore exec-maven-plugin-1.6.0/.gitignore --- exec-maven-plugin-1.1.1+dfsg/.gitignore 1970-01-01 00:00:00.000000000 +0000 +++ exec-maven-plugin-1.6.0/.gitignore 2017-03-02 20:58:24.000000000 +0000 @@ -0,0 +1,16 @@ +*.iml +*.ipr +target +*.iws +.classpath +dependency-reduced-pom.xml +build +.classpath +.project +.settings +.idea +.surefire-* +.DS_Store +*.versionsBackup +test-output + diff -Nru exec-maven-plugin-1.1.1+dfsg/LICENSE.txt exec-maven-plugin-1.6.0/LICENSE.txt --- exec-maven-plugin-1.1.1+dfsg/LICENSE.txt 2009-11-26 14:32:11.000000000 +0000 +++ exec-maven-plugin-1.6.0/LICENSE.txt 2017-03-02 20:58:24.000000000 +0000 @@ -1,21 +1,202 @@ -The MIT License -Copyright (c) 2005-2006, The Codehaus + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ -Permission is hereby granted, free of charge, to any person obtaining a copy of -this software and associated documentation files (the "Software"), to deal in -the Software without restriction, including without limitation the rights to -use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies -of the Software, and to permit persons to whom the Software is furnished to do -so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + 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. diff -Nru exec-maven-plugin-1.1.1+dfsg/pom.xml exec-maven-plugin-1.6.0/pom.xml --- exec-maven-plugin-1.1.1+dfsg/pom.xml 2009-11-26 14:32:11.000000000 +0000 +++ exec-maven-plugin-1.6.0/pom.xml 2017-03-02 20:58:24.000000000 +0000 @@ -1,27 +1,31 @@ - + 4.0.0 org.codehaus.mojo mojo-parent - 20 + 40 exec-maven-plugin - 1.1.1 + 1.6.0 maven-plugin Exec Maven Plugin A plugin to allow execution of system and Java programs - http://mojo.codehaus.org/exec-maven-plugin + http://www.mojohaus.org/exec-maven-plugin 2005 - 2.0.6 + ${mavenVersion} - jira - http://jira.codehaus.org/browse/MEXEC + GitHub + https://github.com/mojohaus/exec-maven-plugin/issues/ + + Travis-CI + https://travis-ci.org/mojohaus/exec-maven-plugin + @@ -46,6 +50,18 @@ +1 + + rfscholte + Robert Scholte + rfscholte@apache.org + Europe/Amsterdam + + + khmarbaise + Karl Heinz Marbaise + khmarbaise@apache.org + Europe/Berlin + @@ -63,6 +79,16 @@ Patch Contributor + + Markus KARG + markus@headcrashing.eu + Head Crashing Informatics + http://www.headcrashing.eu + + Patch Contributor + + Europe/Berlin + @@ -74,62 +100,252 @@ - scm:svn:http://svn.codehaus.org/mojo/tags/exec-maven-plugin-1.1.1 - scm:svn:https://svn.codehaus.org/mojo/tags/exec-maven-plugin-1.1.1 - http://fisheye.codehaus.org/browse/mojo/tags/exec-maven-plugin-1.1.1 + scm:git:https://github.com/mojohaus/exec-maven-plugin.git + scm:git:ssh://git@github.com/mojohaus/exec-maven-plugin.git + https://github.com/mojohaus/exec-maven-plugin + exec-maven-plugin-1.6.0 org.apache.maven maven-toolchain - 1.0 + ${mavenVersion} org.apache.maven maven-project - 2.0.6 + ${mavenVersion} org.apache.maven maven-model - 2.0.6 + ${mavenVersion} org.apache.maven maven-artifact - 2.0.6 + ${mavenVersion} org.apache.maven maven-artifact-manager - 2.0.6 + ${mavenVersion} org.apache.maven maven-core - 2.0.6 + ${mavenVersion} + org.apache.maven maven-plugin-api - 2.0.6 + ${mavenVersion} org.codehaus.plexus plexus-utils - 1.5.6 + 3.0.20 + + + + org.apache.maven.plugin-tools + maven-plugin-annotations + 3.4 + provided + org.codehaus.plexus - plexus-container-default - 1.0-alpha-9 + plexus-component-annotations + 1.6 + provided + + + + org.apache.commons + commons-exec + 1.3 + org.apache.maven.shared maven-plugin-testing-harness - 1.0-beta-1 + 1.1 test + + org.codehaus.plexus + plexus-interpolation + 1.21 + test + + + + + 2.2.1 + + + + + + + org.apache.maven.plugins + maven-gpg-plugin + 1.6 + + + false + + + + org.apache.maven.plugins + maven-plugin-plugin + 3.4 + + exec + true + + + + + + + org.codehaus.mojo + animal-sniffer-maven-plugin + + + + check + + + + + + org.codehaus.mojo.signature + java17 + 1.0 + + + + + org.codehaus.plexus + plexus-component-metadata + 1.7 + + + + generate-metadata + + + + + + + + + + run-its + + + + org.codehaus.gmaven + gmaven-plugin + 1.5 + + + org.codehaus.groovy + groovy + 1.8.4 + + + org.codehaus.gmaven.runtime + gmaven-runtime-1.8 + 1.4 + + + + false + true + true + .groovy + + + + + testCompile + + + + + + + org.apache.maven.plugins + maven-invoker-plugin + + true + true + ${project.build.directory}/local-repo + ${project.build.directory}/it + src/it + true + + setup/pom.xml + + + */pom.xml + + setup + verify + src/it/settings.xml + + 1 + + ${mojo.java.target} + ${mojo.java.target} + + + + + pre-integration-tests + + install + + + + org.apache.maven.plugins:maven-compiler-plugin:3.1:maven-plugin + org.apache.maven.plugins:maven-install-plugin:2.4:maven-plugin + org.apache.maven.plugins:maven-clean-plugin:2.5:maven-plugin + org.apache.maven.plugins:maven-surefire-plugin:2.16:maven-plugin + org.apache.maven.plugins:maven-assembly-plugin:2.4:maven-plugin + org.apache.maven.plugins:maven-jar-plugin:2.4:maven-plugin + org.apache.maven.plugins:maven-war-plugin:2.3:maven-plugin + org.apache.maven.plugins:maven-resources-plugin:2.6:maven-plugin + org.apache.maven.plugins:maven-site-plugin:3.3:maven-plugin + org.apache.maven.plugins:maven-site-plugin:2.0.1:maven-plugin + commons-io:commons-io:1.1:jar + commons-logging:commons-logging:1.0.4:jar + org.codehaus.plexus:plexus-utils:1.1:jar + + + + + integration-tests + + run + + + + + + + + diff -Nru exec-maven-plugin-1.1.1+dfsg/README.md exec-maven-plugin-1.6.0/README.md --- exec-maven-plugin-1.1.1+dfsg/README.md 1970-01-01 00:00:00.000000000 +0000 +++ exec-maven-plugin-1.6.0/README.md 2017-03-02 20:58:24.000000000 +0000 @@ -0,0 +1,20 @@ +# MojoHaus Exec Maven Plugin + +This is the [exec-maven-plugin](http://www.mojohaus.org/exec-maven-plugin/). + +[![Apache License, Version 2.0, January 2004](https://img.shields.io/github/license/mojohaus/sql-maven-plugin.svg?label=License)](http://www.apache.org/licenses/) +[![Maven Central](https://img.shields.io/maven-central/v/org.codehaus.mojo/exec-maven-plugin.svg?label=Maven%20Central)](http://search.maven.org/#search%7Cga%7C1%7Cg%3A%22org.codehaus.mojo%22%20a%3A%22exec-maven-plugin%22) +[![Build Status](https://travis-ci.org/mojohaus/exec-maven-plugin.svg?branch=master)](https://travis-ci.org/mojohaus/exec-maven-plugin) +[![Build Status (AppVeyor)](https://ci.appveyor.com/api/projects/status/github/mojohaus/exec-maven-plugin?branch=master&svg=true)](https://ci.appveyor.com/project/khmarbaise/exec-maven-plugin) + +## Releasing + +* Make sure `gpg-agent` is running. +* Execute `mvn -B release:prepare release:perform` + +For publishing the site do the following: + +``` +cd target/checkout +mvn verify site site:stage scm-publish:publish-scm +``` diff -Nru exec-maven-plugin-1.1.1+dfsg/src/it/async/invoker.properties exec-maven-plugin-1.6.0/src/it/async/invoker.properties --- exec-maven-plugin-1.1.1+dfsg/src/it/async/invoker.properties 1970-01-01 00:00:00.000000000 +0000 +++ exec-maven-plugin-1.6.0/src/it/async/invoker.properties 2017-03-02 20:58:24.000000000 +0000 @@ -0,0 +1,3 @@ +invoker.goals = clean test +# For reasons unknown, this test fails under OpenJDK-1.6 on travis-ci. +invoker.java.version = 1.7+ diff -Nru exec-maven-plugin-1.1.1+dfsg/src/it/async/pom.xml exec-maven-plugin-1.6.0/src/it/async/pom.xml --- exec-maven-plugin-1.1.1+dfsg/src/it/async/pom.xml 1970-01-01 00:00:00.000000000 +0000 +++ exec-maven-plugin-1.6.0/src/it/async/pom.xml 2017-03-02 20:58:24.000000000 +0000 @@ -0,0 +1,70 @@ + + + 4.0.0 + + + org.codehaus.mojo.exec.it + parent + 0.1 + + + async + 0.0.1-SNAPSHOT + pom + + + + + + + + + org.codehaus.mojo + exec-maven-plugin + @pom.version@ + + + async-it + test + + exec + + + ${shellscript.qualifier}async-it + src/main/scripts + true + + + + + + + post-async-it + test + + exec + + + ${shellscript.qualifier}post-async-it + src/main/scripts + + + + + + + + + Unix + + + unix + + + + ./ + + + + diff -Nru exec-maven-plugin-1.1.1+dfsg/src/it/async/src/main/scripts/async-it exec-maven-plugin-1.6.0/src/it/async/src/main/scripts/async-it --- exec-maven-plugin-1.1.1+dfsg/src/it/async/src/main/scripts/async-it 1970-01-01 00:00:00.000000000 +0000 +++ exec-maven-plugin-1.6.0/src/it/async/src/main/scripts/async-it 2017-03-02 20:58:24.000000000 +0000 @@ -0,0 +1,5 @@ +#! /bin/sh +echo async exec:exec test +# Block, so that we're still executing when the Maven JVM shuts down and destroys our shell process +sleep 3600 +echo async exec:exec post-test diff -Nru exec-maven-plugin-1.1.1+dfsg/src/it/async/src/main/scripts/async-it.cmd exec-maven-plugin-1.6.0/src/it/async/src/main/scripts/async-it.cmd --- exec-maven-plugin-1.1.1+dfsg/src/it/async/src/main/scripts/async-it.cmd 1970-01-01 00:00:00.000000000 +0000 +++ exec-maven-plugin-1.6.0/src/it/async/src/main/scripts/async-it.cmd 2017-03-02 20:58:24.000000000 +0000 @@ -0,0 +1,5 @@ +@echo off +echo async exec:exec test +rem Block, so that we're still executing when the Maven JVM shuts down and destroys our shell process +pause > nul +echo async exec:exec post-test diff -Nru exec-maven-plugin-1.1.1+dfsg/src/it/async/src/main/scripts/post-async-it exec-maven-plugin-1.6.0/src/it/async/src/main/scripts/post-async-it --- exec-maven-plugin-1.1.1+dfsg/src/it/async/src/main/scripts/post-async-it 1970-01-01 00:00:00.000000000 +0000 +++ exec-maven-plugin-1.6.0/src/it/async/src/main/scripts/post-async-it 2017-03-02 20:58:24.000000000 +0000 @@ -0,0 +1,4 @@ +#! /bin/sh +# Wait for just long enough for the async-it script to start up and emit its verify message +sleep 2 +echo post-async-it diff -Nru exec-maven-plugin-1.1.1+dfsg/src/it/async/src/main/scripts/post-async-it.cmd exec-maven-plugin-1.6.0/src/it/async/src/main/scripts/post-async-it.cmd --- exec-maven-plugin-1.1.1+dfsg/src/it/async/src/main/scripts/post-async-it.cmd 1970-01-01 00:00:00.000000000 +0000 +++ exec-maven-plugin-1.6.0/src/it/async/src/main/scripts/post-async-it.cmd 2017-03-02 20:58:24.000000000 +0000 @@ -0,0 +1,6 @@ +@echo off +rem Wait for just long enough for the async-it.cmd script to start up and emit its verify message +rem Can't use Windows timeout command as it throws ERROR: Input redirection is not supported, exiting the process immediately. +rem timeout 1 /nobreak > nul +waitfor /T 2 xxx > nul +echo post-async-it diff -Nru exec-maven-plugin-1.1.1+dfsg/src/it/async/verify.groovy exec-maven-plugin-1.6.0/src/it/async/verify.groovy --- exec-maven-plugin-1.1.1+dfsg/src/it/async/verify.groovy 1970-01-01 00:00:00.000000000 +0000 +++ exec-maven-plugin-1.6.0/src/it/async/verify.groovy 2017-03-02 20:58:24.000000000 +0000 @@ -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 log = new File(basedir, 'build.log') +assert log.exists() + +assert log.getText().contains( "async exec:exec test" ) +assert !log.getText().contains( "async exec:exec post-test" ) +assert log.getText().contains( "post-async-it" ) diff -Nru exec-maven-plugin-1.1.1+dfsg/src/it/envscript/invoker.properties exec-maven-plugin-1.6.0/src/it/envscript/invoker.properties --- exec-maven-plugin-1.1.1+dfsg/src/it/envscript/invoker.properties 1970-01-01 00:00:00.000000000 +0000 +++ exec-maven-plugin-1.6.0/src/it/envscript/invoker.properties 2017-03-02 20:58:24.000000000 +0000 @@ -0,0 +1,4 @@ +invoker.goals = clean test + +invoker.debug = true +invoker.buildResult = true diff -Nru exec-maven-plugin-1.1.1+dfsg/src/it/envscript/pom.xml exec-maven-plugin-1.6.0/src/it/envscript/pom.xml --- exec-maven-plugin-1.1.1+dfsg/src/it/envscript/pom.xml 1970-01-01 00:00:00.000000000 +0000 +++ exec-maven-plugin-1.6.0/src/it/envscript/pom.xml 2017-03-02 20:58:24.000000000 +0000 @@ -0,0 +1,74 @@ + + + 4.0.0 + + + org.codehaus.mojo.exec.it + parent + 0.1 + + + mexec-envscript + 0.0.1-SNAPSHOT + pom + + + env.sh + + + + + + org.codehaus.mojo + exec-maven-plugin + @pom.version@ + + + with-env-script + test + + exec + + + ${JAVA_HOME}/bin/java + + -version + + src/build/${envScript} + + + + without-env-script + test + + exec + + + ${JAVA_HOME}/bin/java + + -version + + + + + + + + + + + + windows + + + Windows + + + + env.bat + + + + + diff -Nru exec-maven-plugin-1.1.1+dfsg/src/it/envscript/src/build/env.bat exec-maven-plugin-1.6.0/src/it/envscript/src/build/env.bat --- exec-maven-plugin-1.1.1+dfsg/src/it/envscript/src/build/env.bat 1970-01-01 00:00:00.000000000 +0000 +++ exec-maven-plugin-1.6.0/src/it/envscript/src/build/env.bat 2017-03-02 20:58:24.000000000 +0000 @@ -0,0 +1 @@ +set MY_ENV_SCRIPT_SET_A_VAR_TO=something \ No newline at end of file diff -Nru exec-maven-plugin-1.1.1+dfsg/src/it/envscript/src/build/env.sh exec-maven-plugin-1.6.0/src/it/envscript/src/build/env.sh --- exec-maven-plugin-1.1.1+dfsg/src/it/envscript/src/build/env.sh 1970-01-01 00:00:00.000000000 +0000 +++ exec-maven-plugin-1.6.0/src/it/envscript/src/build/env.sh 2017-03-02 20:58:24.000000000 +0000 @@ -0,0 +1,2 @@ +MY_ENV_SCRIPT_SET_A_VAR_TO=something +export MY_ENV_SCRIPT_SET_A_VAR_TO \ No newline at end of file diff -Nru exec-maven-plugin-1.1.1+dfsg/src/it/envscript/verify.groovy exec-maven-plugin-1.6.0/src/it/envscript/verify.groovy --- exec-maven-plugin-1.1.1+dfsg/src/it/envscript/verify.groovy 1970-01-01 00:00:00.000000000 +0000 +++ exec-maven-plugin-1.6.0/src/it/envscript/verify.groovy 2017-03-02 20:58:24.000000000 +0000 @@ -0,0 +1,21 @@ +/* + * 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 log = new File(basedir, 'build.log') +assert log.exists() +assert log.getText().contains( "[DEBUG] env: MY_ENV_SCRIPT_SET_A_VAR_TO=something") \ No newline at end of file diff -Nru exec-maven-plugin-1.1.1+dfsg/src/it/jigsaw/invoker.properties exec-maven-plugin-1.6.0/src/it/jigsaw/invoker.properties --- exec-maven-plugin-1.1.1+dfsg/src/it/jigsaw/invoker.properties 1970-01-01 00:00:00.000000000 +0000 +++ exec-maven-plugin-1.6.0/src/it/jigsaw/invoker.properties 2017-03-02 20:58:24.000000000 +0000 @@ -0,0 +1,2 @@ +invoker.goals.1 = clean compile exec:exec +invoker.java.version = 9+ \ No newline at end of file diff -Nru exec-maven-plugin-1.1.1+dfsg/src/it/jigsaw/pom.xml exec-maven-plugin-1.6.0/src/it/jigsaw/pom.xml --- exec-maven-plugin-1.1.1+dfsg/src/it/jigsaw/pom.xml 1970-01-01 00:00:00.000000000 +0000 +++ exec-maven-plugin-1.6.0/src/it/jigsaw/pom.xml 2017-03-02 20:58:24.000000000 +0000 @@ -0,0 +1,50 @@ + + + 4.0.0 + + + org.codehaus.mojo.exec.it + parent + 0.1 + + + jigsaw + 0.0.1-SNAPSHOT + + + + + org.apache.maven.plugins + maven-compiler-plugin + 3.6.1 + + 9 + 9 + + + + org.codehaus.mojo + exec-maven-plugin + @project.version@ + + ${JAVA_HOME}/bin/java + + -p + + -m + exec.boot/org.mojohaus.exec.Main + + + + + + + + + org.codehaus.plexus + plexus-utils + 1.1 + + + diff -Nru exec-maven-plugin-1.1.1+dfsg/src/it/jigsaw/src/main/java/module-info.java exec-maven-plugin-1.6.0/src/it/jigsaw/src/main/java/module-info.java --- exec-maven-plugin-1.1.1+dfsg/src/it/jigsaw/src/main/java/module-info.java 1970-01-01 00:00:00.000000000 +0000 +++ exec-maven-plugin-1.6.0/src/it/jigsaw/src/main/java/module-info.java 2017-03-02 20:58:24.000000000 +0000 @@ -0,0 +1,6 @@ +module exec.boot +{ + requires plexus.utils; + + exports org.mojohaus.exec; +} \ No newline at end of file diff -Nru exec-maven-plugin-1.1.1+dfsg/src/it/jigsaw/src/main/java/org/mojohaus/exec/Main.java exec-maven-plugin-1.6.0/src/it/jigsaw/src/main/java/org/mojohaus/exec/Main.java --- exec-maven-plugin-1.1.1+dfsg/src/it/jigsaw/src/main/java/org/mojohaus/exec/Main.java 1970-01-01 00:00:00.000000000 +0000 +++ exec-maven-plugin-1.6.0/src/it/jigsaw/src/main/java/org/mojohaus/exec/Main.java 2017-03-02 20:58:24.000000000 +0000 @@ -0,0 +1,9 @@ +package org.mojohaus.exec; + +public class Main +{ + public static void main(String[] args) + { + System.out.println( "Hello World" ); + } +} \ No newline at end of file diff -Nru exec-maven-plugin-1.1.1+dfsg/src/it/jigsaw/verify.groovy exec-maven-plugin-1.6.0/src/it/jigsaw/verify.groovy --- exec-maven-plugin-1.1.1+dfsg/src/it/jigsaw/verify.groovy 1970-01-01 00:00:00.000000000 +0000 +++ exec-maven-plugin-1.6.0/src/it/jigsaw/verify.groovy 2017-03-02 20:58:24.000000000 +0000 @@ -0,0 +1,21 @@ +/* + * 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 log = new File(basedir, 'build.log') +assert log.exists() +assert 1 == log.readLines().count( "Hello World") \ No newline at end of file diff -Nru exec-maven-plugin-1.1.1+dfsg/src/it/mexec-100/invoker.properties exec-maven-plugin-1.6.0/src/it/mexec-100/invoker.properties --- exec-maven-plugin-1.1.1+dfsg/src/it/mexec-100/invoker.properties 1970-01-01 00:00:00.000000000 +0000 +++ exec-maven-plugin-1.6.0/src/it/mexec-100/invoker.properties 2017-03-02 20:58:24.000000000 +0000 @@ -0,0 +1 @@ +invoker.goals = clean exec:exec \ No newline at end of file diff -Nru exec-maven-plugin-1.1.1+dfsg/src/it/mexec-100/pom.xml exec-maven-plugin-1.6.0/src/it/mexec-100/pom.xml --- exec-maven-plugin-1.1.1+dfsg/src/it/mexec-100/pom.xml 1970-01-01 00:00:00.000000000 +0000 +++ exec-maven-plugin-1.6.0/src/it/mexec-100/pom.xml 2017-03-02 20:58:24.000000000 +0000 @@ -0,0 +1,31 @@ + + + 4.0.0 + + + org.codehaus.mojo.exec.it + parent + 0.1 + + + mexec-100 + 0.0.1-SNAPSHOT + + + + + org.codehaus.mojo + exec-maven-plugin + @project.version@ + + ${JAVA_HOME}/bin/java + + -version + -Dsome.file="${project.build.directory}/Name With Spaces.exe" + + + + + + diff -Nru exec-maven-plugin-1.1.1+dfsg/src/it/mexec-104/invoker.properties exec-maven-plugin-1.6.0/src/it/mexec-104/invoker.properties --- exec-maven-plugin-1.1.1+dfsg/src/it/mexec-104/invoker.properties 1970-01-01 00:00:00.000000000 +0000 +++ exec-maven-plugin-1.6.0/src/it/mexec-104/invoker.properties 2017-03-02 20:58:24.000000000 +0000 @@ -0,0 +1,2 @@ +invoker.goals = clean package +invoker.buildResult = success diff -Nru exec-maven-plugin-1.1.1+dfsg/src/it/mexec-104/pom.xml exec-maven-plugin-1.6.0/src/it/mexec-104/pom.xml --- exec-maven-plugin-1.1.1+dfsg/src/it/mexec-104/pom.xml 1970-01-01 00:00:00.000000000 +0000 +++ exec-maven-plugin-1.6.0/src/it/mexec-104/pom.xml 2017-03-02 20:58:24.000000000 +0000 @@ -0,0 +1,44 @@ + + + 4.0.0 + + + org.codehaus.mojo.exec.it + parent + 0.1 + + + mexec-104 + 0.0.1-SNAPSHOT + + + + + + + + org.codehaus.mojo + exec-maven-plugin + @pom.version@ + + + process-classes + + exec + + + ${JAVA_HOME}/bin/java + + -cp + target/classes + Main + ${my.val} + + + + + + + + diff -Nru exec-maven-plugin-1.1.1+dfsg/src/it/mexec-104/src/main/java/Main.java exec-maven-plugin-1.6.0/src/it/mexec-104/src/main/java/Main.java --- exec-maven-plugin-1.1.1+dfsg/src/it/mexec-104/src/main/java/Main.java 1970-01-01 00:00:00.000000000 +0000 +++ exec-maven-plugin-1.6.0/src/it/mexec-104/src/main/java/Main.java 2017-03-02 20:58:24.000000000 +0000 @@ -0,0 +1,15 @@ +import java.io.FileWriter; +import java.io.Writer; +import java.net.URL; + +public class Main +{ + public static void main( String[] args ) throws Exception + { + System.out.println( "1. System.out line" ); + System.err.println( "2. System.err line" ); + System.out.println( "3. System.out line" ); + System.err.println( "4. System.err line" ); + System.out.println( "5. System.out line" ); + } +} diff -Nru exec-maven-plugin-1.1.1+dfsg/src/it/mexec-104/verify.groovy exec-maven-plugin-1.6.0/src/it/mexec-104/verify.groovy --- exec-maven-plugin-1.1.1+dfsg/src/it/mexec-104/verify.groovy 1970-01-01 00:00:00.000000000 +0000 +++ exec-maven-plugin-1.6.0/src/it/mexec-104/verify.groovy 2017-03-02 20:58:24.000000000 +0000 @@ -0,0 +1,29 @@ +/* + * 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. + */ + +import java.io.* +import java.util.* + +t = new IntegrationBase() + +def buildLog = new File( basedir, "build.log" ) + +t.checkExistenceAndContentOfAFile(buildLog, [ + "[DEBUG] (f) arguments = [-cp, target/classes, Main, null]", +]) diff -Nru exec-maven-plugin-1.1.1+dfsg/src/it/mexec-105/invoker.properties exec-maven-plugin-1.6.0/src/it/mexec-105/invoker.properties --- exec-maven-plugin-1.1.1+dfsg/src/it/mexec-105/invoker.properties 1970-01-01 00:00:00.000000000 +0000 +++ exec-maven-plugin-1.6.0/src/it/mexec-105/invoker.properties 2017-03-02 20:58:24.000000000 +0000 @@ -0,0 +1 @@ +invoker.goals = clean process-classes \ No newline at end of file diff -Nru exec-maven-plugin-1.1.1+dfsg/src/it/mexec-105/pom.xml exec-maven-plugin-1.6.0/src/it/mexec-105/pom.xml --- exec-maven-plugin-1.1.1+dfsg/src/it/mexec-105/pom.xml 1970-01-01 00:00:00.000000000 +0000 +++ exec-maven-plugin-1.6.0/src/it/mexec-105/pom.xml 2017-03-02 20:58:24.000000000 +0000 @@ -0,0 +1,41 @@ + + + 4.0.0 + + + org.codehaus.mojo.exec.it + parent + 0.1 + + + mexec-105 + 0.0.1-SNAPSHOT + + + + + org.codehaus.mojo + exec-maven-plugin + @project.version@ + + + process-classes + + exec + + + + + -classpath %classpath + Main + + + + + ${JAVA_HOME}/bin/java + + + + + diff -Nru exec-maven-plugin-1.1.1+dfsg/src/it/mexec-105/src/main/java/Main.java exec-maven-plugin-1.6.0/src/it/mexec-105/src/main/java/Main.java --- exec-maven-plugin-1.1.1+dfsg/src/it/mexec-105/src/main/java/Main.java 1970-01-01 00:00:00.000000000 +0000 +++ exec-maven-plugin-1.6.0/src/it/mexec-105/src/main/java/Main.java 2017-03-02 20:58:24.000000000 +0000 @@ -0,0 +1,10 @@ +import java.io.FileWriter; +import java.io.Writer; +import java.net.URL; + +public class Main +{ + public static void main( String[] args ) throws Exception + { + } +} diff -Nru exec-maven-plugin-1.1.1+dfsg/src/it/mexec-108/invoker.properties exec-maven-plugin-1.6.0/src/it/mexec-108/invoker.properties --- exec-maven-plugin-1.1.1+dfsg/src/it/mexec-108/invoker.properties 1970-01-01 00:00:00.000000000 +0000 +++ exec-maven-plugin-1.6.0/src/it/mexec-108/invoker.properties 2017-03-02 20:58:24.000000000 +0000 @@ -0,0 +1,2 @@ +invoker.goals = clean package +invoker.buildResult = success diff -Nru exec-maven-plugin-1.1.1+dfsg/src/it/mexec-108/pom.xml exec-maven-plugin-1.6.0/src/it/mexec-108/pom.xml --- exec-maven-plugin-1.1.1+dfsg/src/it/mexec-108/pom.xml 1970-01-01 00:00:00.000000000 +0000 +++ exec-maven-plugin-1.6.0/src/it/mexec-108/pom.xml 2017-03-02 20:58:24.000000000 +0000 @@ -0,0 +1,42 @@ + + 4.0.0 + + + org.codehaus.mojo.exec.it + parent + 0.1 + + + mexec-108 + 0.0.1-SNAPSHOT + + + + + org.codehaus.mojo + exec-maven-plugin + @project.version@ + + + + exec + + process-classes + + + + + ${JAVA_HOME}/bin/java + + -cp + target/classes + Main + + + + + + + + diff -Nru exec-maven-plugin-1.1.1+dfsg/src/it/mexec-108/src/main/java/Main.java exec-maven-plugin-1.6.0/src/it/mexec-108/src/main/java/Main.java --- exec-maven-plugin-1.1.1+dfsg/src/it/mexec-108/src/main/java/Main.java 1970-01-01 00:00:00.000000000 +0000 +++ exec-maven-plugin-1.6.0/src/it/mexec-108/src/main/java/Main.java 2017-03-02 20:58:24.000000000 +0000 @@ -0,0 +1,15 @@ +import java.io.FileWriter; +import java.io.Writer; +import java.net.URL; + +public class Main +{ + public static void main( String[] args ) throws Exception + { + System.out.println( "1. System.out line" ); + System.err.println( "2. System.err line" ); + System.out.println( "3. System.out line" ); + System.err.println( "4. System.err line" ); + System.out.println( "5. System.out line" ); + } +} diff -Nru exec-maven-plugin-1.1.1+dfsg/src/it/mexec-108/verify.groovy exec-maven-plugin-1.6.0/src/it/mexec-108/verify.groovy --- exec-maven-plugin-1.1.1+dfsg/src/it/mexec-108/verify.groovy 1970-01-01 00:00:00.000000000 +0000 +++ exec-maven-plugin-1.6.0/src/it/mexec-108/verify.groovy 2017-03-02 20:58:24.000000000 +0000 @@ -0,0 +1,30 @@ +/* + * 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. + */ + +import java.io.* +import java.util.* + +t = new IntegrationBase() + +def buildLog = new File( basedir, "build.log" ) + +t.checkExistenceAndContentOfAFile(buildLog, [ + "[DEBUG] (f) environmentVariables = {key=null}", + "[DEBUG] (f) arguments = [-cp, target/classes, Main]", +]) diff -Nru exec-maven-plugin-1.1.1+dfsg/src/it/mexec-137/invoker.properties exec-maven-plugin-1.6.0/src/it/mexec-137/invoker.properties --- exec-maven-plugin-1.1.1+dfsg/src/it/mexec-137/invoker.properties 1970-01-01 00:00:00.000000000 +0000 +++ exec-maven-plugin-1.6.0/src/it/mexec-137/invoker.properties 2017-03-02 20:58:24.000000000 +0000 @@ -0,0 +1,5 @@ +invoker.goals = clean test + +invoker.os.family = windows +invoker.debug = false +invoker.buildResult = true diff -Nru exec-maven-plugin-1.1.1+dfsg/src/it/mexec-137/pom.xml exec-maven-plugin-1.6.0/src/it/mexec-137/pom.xml --- exec-maven-plugin-1.1.1+dfsg/src/it/mexec-137/pom.xml 1970-01-01 00:00:00.000000000 +0000 +++ exec-maven-plugin-1.6.0/src/it/mexec-137/pom.xml 2017-03-02 20:58:24.000000000 +0000 @@ -0,0 +1,38 @@ + + + 4.0.0 + + + org.codehaus.mojo.exec.it + parent + 0.1 + + + mexec-137 + 0.0.1-SNAPSHOT + pom + + + + + org.codehaus.mojo + exec-maven-plugin + @pom.version@ + + + test + + exec + + + test + src/build + + + + + + + + diff -Nru exec-maven-plugin-1.1.1+dfsg/src/it/mexec-137/src/build/test exec-maven-plugin-1.6.0/src/it/mexec-137/src/build/test --- exec-maven-plugin-1.1.1+dfsg/src/it/mexec-137/src/build/test 1970-01-01 00:00:00.000000000 +0000 +++ exec-maven-plugin-1.6.0/src/it/mexec-137/src/build/test 2017-03-02 20:58:24.000000000 +0000 @@ -0,0 +1,2 @@ +#! /bin/sh +echo Hello from exec-maven-plugin \ No newline at end of file diff -Nru exec-maven-plugin-1.1.1+dfsg/src/it/mexec-137/src/build/test.cmd exec-maven-plugin-1.6.0/src/it/mexec-137/src/build/test.cmd --- exec-maven-plugin-1.1.1+dfsg/src/it/mexec-137/src/build/test.cmd 1970-01-01 00:00:00.000000000 +0000 +++ exec-maven-plugin-1.6.0/src/it/mexec-137/src/build/test.cmd 2017-03-02 20:58:24.000000000 +0000 @@ -0,0 +1 @@ +echo Hello from exec-maven-plugin \ No newline at end of file diff -Nru exec-maven-plugin-1.1.1+dfsg/src/it/mexec-137/verify.groovy exec-maven-plugin-1.6.0/src/it/mexec-137/verify.groovy --- exec-maven-plugin-1.1.1+dfsg/src/it/mexec-137/verify.groovy 1970-01-01 00:00:00.000000000 +0000 +++ exec-maven-plugin-1.6.0/src/it/mexec-137/verify.groovy 2017-03-02 20:58:24.000000000 +0000 @@ -0,0 +1,21 @@ +/* + * 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 log = new File(basedir, 'build.log') +assert log.exists() +assert log.getText().contains( "Hello from exec-maven-plugin" ) \ No newline at end of file diff -Nru exec-maven-plugin-1.1.1+dfsg/src/it/mexec-29/invoker.properties exec-maven-plugin-1.6.0/src/it/mexec-29/invoker.properties --- exec-maven-plugin-1.1.1+dfsg/src/it/mexec-29/invoker.properties 1970-01-01 00:00:00.000000000 +0000 +++ exec-maven-plugin-1.6.0/src/it/mexec-29/invoker.properties 2017-03-02 20:58:24.000000000 +0000 @@ -0,0 +1,4 @@ +invoker.goals = clean verify + +invoker.debug = true +invoker.buildResult = failure diff -Nru exec-maven-plugin-1.1.1+dfsg/src/it/mexec-29/pom.xml exec-maven-plugin-1.6.0/src/it/mexec-29/pom.xml --- exec-maven-plugin-1.1.1+dfsg/src/it/mexec-29/pom.xml 1970-01-01 00:00:00.000000000 +0000 +++ exec-maven-plugin-1.6.0/src/it/mexec-29/pom.xml 2017-03-02 20:58:24.000000000 +0000 @@ -0,0 +1,63 @@ + + 4.0.0 + + + org.codehaus.mojo.exec.it + parent + 0.1 + + + org.cb.maven.plugins.exec + project1 + 0.1 + jar + Maven Exec Plugin + 2005 + + + + Jerome Lacoste + jerome + jerome@coffeebreaks.org + CoffeeBreaks + http://www.coffeebreaks.org + + Java Developer + + +1 + + + + + + commons-io + commons-io + + + commons-logging + commons-logging + + + + + + + org.codehaus.mojo + exec-maven-plugin + @pom.version@ + + + test + + java + + + + + org.codehaus.mojo.exec.NoMain + + + + + + diff -Nru exec-maven-plugin-1.1.1+dfsg/src/it/mexec-29/verify.groovy exec-maven-plugin-1.6.0/src/it/mexec-29/verify.groovy --- exec-maven-plugin-1.1.1+dfsg/src/it/mexec-29/verify.groovy 1970-01-01 00:00:00.000000000 +0000 +++ exec-maven-plugin-1.6.0/src/it/mexec-29/verify.groovy 2017-03-02 20:58:24.000000000 +0000 @@ -0,0 +1,30 @@ +/* + * 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. + */ + +import java.io.* +import java.util.* + +t = new IntegrationBase() + +def buildLog = new File( basedir, "build.log" ) + +t.checkExistenceAndContentOfAFile(buildLog, [ + "java.lang.ClassNotFoundException: org.codehaus.mojo.exec.NoMain", +]) + diff -Nru exec-maven-plugin-1.1.1+dfsg/src/it/mexec-29-non-static/invoker.properties exec-maven-plugin-1.6.0/src/it/mexec-29-non-static/invoker.properties --- exec-maven-plugin-1.1.1+dfsg/src/it/mexec-29-non-static/invoker.properties 1970-01-01 00:00:00.000000000 +0000 +++ exec-maven-plugin-1.6.0/src/it/mexec-29-non-static/invoker.properties 2017-03-02 20:58:24.000000000 +0000 @@ -0,0 +1,2 @@ +invoker.goals = clean verify +invoker.buildResult = failure diff -Nru exec-maven-plugin-1.1.1+dfsg/src/it/mexec-29-non-static/pom.xml exec-maven-plugin-1.6.0/src/it/mexec-29-non-static/pom.xml --- exec-maven-plugin-1.1.1+dfsg/src/it/mexec-29-non-static/pom.xml 1970-01-01 00:00:00.000000000 +0000 +++ exec-maven-plugin-1.6.0/src/it/mexec-29-non-static/pom.xml 2017-03-02 20:58:24.000000000 +0000 @@ -0,0 +1,63 @@ + + 4.0.0 + + + org.codehaus.mojo.exec.it + parent + 0.1 + + + org.cb.maven.plugins.exec + project1 + 0.1 + jar + Maven Exec Plugin + 2005 + + + + Jerome Lacoste + jerome + jerome@coffeebreaks.org + CoffeeBreaks + http://www.coffeebreaks.org + + Java Developer + + +1 + + + + + + commons-io + commons-io + + + commons-logging + commons-logging + + + + + + + org.codehaus.mojo + exec-maven-plugin + @pom.version@ + + + test + + java + + + + + org.codehaus.mojo.exec.Main + + + + + + diff -Nru exec-maven-plugin-1.1.1+dfsg/src/it/mexec-29-non-static/src/main/java/org/codehaus/mojo/exec/Main.java exec-maven-plugin-1.6.0/src/it/mexec-29-non-static/src/main/java/org/codehaus/mojo/exec/Main.java --- exec-maven-plugin-1.1.1+dfsg/src/it/mexec-29-non-static/src/main/java/org/codehaus/mojo/exec/Main.java 1970-01-01 00:00:00.000000000 +0000 +++ exec-maven-plugin-1.6.0/src/it/mexec-29-non-static/src/main/java/org/codehaus/mojo/exec/Main.java 2017-03-02 20:58:24.000000000 +0000 @@ -0,0 +1,10 @@ +package org.codehaus.mojo.exec; + +public class Main +{ + + // Watch it: not static!! + public void main( String[] args ) + { + } +} diff -Nru exec-maven-plugin-1.1.1+dfsg/src/it/mexec-29-non-static/verify.groovy exec-maven-plugin-1.6.0/src/it/mexec-29-non-static/verify.groovy --- exec-maven-plugin-1.1.1+dfsg/src/it/mexec-29-non-static/verify.groovy 1970-01-01 00:00:00.000000000 +0000 +++ exec-maven-plugin-1.6.0/src/it/mexec-29-non-static/verify.groovy 2017-03-02 20:58:24.000000000 +0000 @@ -0,0 +1,34 @@ +/* + * 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. + */ + +import java.io.* +import java.util.* + +t = new IntegrationBase() + +def buildLog = new File( basedir, "build.log" ) + +t.checkExistenceAndContentOfAFile(buildLog, [ + "[DEBUG] Setting accessibility to true in order to invoke main().", + "org.apache.maven.plugin.MojoExecutionException: Can't call main(String[])-method because it is not static.", +]) + + + + diff -Nru exec-maven-plugin-1.1.1+dfsg/src/it/mexec-29-wrong-signature/invoker.properties exec-maven-plugin-1.6.0/src/it/mexec-29-wrong-signature/invoker.properties --- exec-maven-plugin-1.1.1+dfsg/src/it/mexec-29-wrong-signature/invoker.properties 1970-01-01 00:00:00.000000000 +0000 +++ exec-maven-plugin-1.6.0/src/it/mexec-29-wrong-signature/invoker.properties 2017-03-02 20:58:24.000000000 +0000 @@ -0,0 +1,2 @@ +invoker.goals = clean verify +invoker.buildResult = failure diff -Nru exec-maven-plugin-1.1.1+dfsg/src/it/mexec-29-wrong-signature/pom.xml exec-maven-plugin-1.6.0/src/it/mexec-29-wrong-signature/pom.xml --- exec-maven-plugin-1.1.1+dfsg/src/it/mexec-29-wrong-signature/pom.xml 1970-01-01 00:00:00.000000000 +0000 +++ exec-maven-plugin-1.6.0/src/it/mexec-29-wrong-signature/pom.xml 2017-03-02 20:58:24.000000000 +0000 @@ -0,0 +1,63 @@ + + 4.0.0 + + + org.codehaus.mojo.exec.it + parent + 0.1 + + + org.cb.maven.plugins.exec + project1 + 0.1 + jar + Maven Exec Plugin + 2005 + + + + Jerome Lacoste + jerome + jerome@coffeebreaks.org + CoffeeBreaks + http://www.coffeebreaks.org + + Java Developer + + +1 + + + + + + commons-io + commons-io + + + commons-logging + commons-logging + + + + + + + org.codehaus.mojo + exec-maven-plugin + @pom.version@ + + + test + + java + + + + + org.codehaus.mojo.exec.Main + + + + + + diff -Nru exec-maven-plugin-1.1.1+dfsg/src/it/mexec-29-wrong-signature/src/main/java/org/codehaus/mojo/exec/Main.java exec-maven-plugin-1.6.0/src/it/mexec-29-wrong-signature/src/main/java/org/codehaus/mojo/exec/Main.java --- exec-maven-plugin-1.1.1+dfsg/src/it/mexec-29-wrong-signature/src/main/java/org/codehaus/mojo/exec/Main.java 1970-01-01 00:00:00.000000000 +0000 +++ exec-maven-plugin-1.6.0/src/it/mexec-29-wrong-signature/src/main/java/org/codehaus/mojo/exec/Main.java 2017-03-02 20:58:24.000000000 +0000 @@ -0,0 +1,10 @@ +package org.codehaus.mojo.exec; + +public class Main +{ + + //Take care: No array as args. + public static void main( String args ) + { + } +} diff -Nru exec-maven-plugin-1.1.1+dfsg/src/it/mexec-29-wrong-signature/verify.groovy exec-maven-plugin-1.6.0/src/it/mexec-29-wrong-signature/verify.groovy --- exec-maven-plugin-1.1.1+dfsg/src/it/mexec-29-wrong-signature/verify.groovy 1970-01-01 00:00:00.000000000 +0000 +++ exec-maven-plugin-1.6.0/src/it/mexec-29-wrong-signature/verify.groovy 2017-03-02 20:58:24.000000000 +0000 @@ -0,0 +1,31 @@ +/* + * 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. + */ + + import java.io.* + import java.util.* + + t = new IntegrationBase() + + def buildLog = new File( basedir, "build.log" ) + + t.checkExistenceAndContentOfAFile(buildLog, [ + "java.lang.Exception: The specified mainClass doesn't contain a main method with appropriate signature." + ]) + + \ No newline at end of file diff -Nru exec-maven-plugin-1.1.1+dfsg/src/it/mexec-66/invoker.properties exec-maven-plugin-1.6.0/src/it/mexec-66/invoker.properties --- exec-maven-plugin-1.1.1+dfsg/src/it/mexec-66/invoker.properties 1970-01-01 00:00:00.000000000 +0000 +++ exec-maven-plugin-1.6.0/src/it/mexec-66/invoker.properties 2017-03-02 20:58:24.000000000 +0000 @@ -0,0 +1 @@ +invoker.goals = clean process-test-resources \ No newline at end of file diff -Nru exec-maven-plugin-1.1.1+dfsg/src/it/mexec-66/pom.xml exec-maven-plugin-1.6.0/src/it/mexec-66/pom.xml --- exec-maven-plugin-1.1.1+dfsg/src/it/mexec-66/pom.xml 1970-01-01 00:00:00.000000000 +0000 +++ exec-maven-plugin-1.6.0/src/it/mexec-66/pom.xml 2017-03-02 20:58:24.000000000 +0000 @@ -0,0 +1,69 @@ + + + 4.0.0 + + + org.codehaus.mojo.exec.it + parent + 0.1 + + + mexec-66 + 0.0.1-SNAPSHOT + + + + + org.codehaus.mojo + exec-maven-plugin + @project.version@ + + + equals-classpath + process-classes + + exec + + + -classpath %classpath Main + + + + pre-classpath + process-classes + + exec + + + -classpath %classpath${path.separator}customdir-after Main + + + + post-classpath + process-classes + + exec + + + -classpath customdir-before${path.separator}%classpath Main + + + + between-classpath + process-classes + + exec + + + -classpath customdir-before${path.separator}%classpath${path.separator}customdir-after Main + + + + + ${JAVA_HOME}/bin/java + + + + + diff -Nru exec-maven-plugin-1.1.1+dfsg/src/it/mexec-66/src/main/java/Main.java exec-maven-plugin-1.6.0/src/it/mexec-66/src/main/java/Main.java --- exec-maven-plugin-1.1.1+dfsg/src/it/mexec-66/src/main/java/Main.java 1970-01-01 00:00:00.000000000 +0000 +++ exec-maven-plugin-1.6.0/src/it/mexec-66/src/main/java/Main.java 2017-03-02 20:58:24.000000000 +0000 @@ -0,0 +1,10 @@ +import java.io.FileWriter; +import java.io.Writer; +import java.net.URL; + +public class Main +{ + public static void main( String[] args ) throws Exception + { + } +} diff -Nru exec-maven-plugin-1.1.1+dfsg/src/it/mexec-66/verify.groovy exec-maven-plugin-1.6.0/src/it/mexec-66/verify.groovy --- exec-maven-plugin-1.1.1+dfsg/src/it/mexec-66/verify.groovy 1970-01-01 00:00:00.000000000 +0000 +++ exec-maven-plugin-1.6.0/src/it/mexec-66/verify.groovy 2017-03-02 20:58:24.000000000 +0000 @@ -0,0 +1,49 @@ +/* + * 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. + */ +import java.io.* +import java.util.* + + +t = new IntegrationBase() + +def buildLog = new File(basedir, 'build.log') +def expectedClasspath = new File(basedir, 'target/classes').getAbsolutePath() + +assert buildLog.exists(); +//[DEBUG] Executing command line: java -classpath /Users/kama/workspace/exec-maven-plugin/target/it/mexec-66/target/classes Main + +//t.checkExistenceAndContentOfAFile(buildLog, [ +// "[DEBUG] Executing command line: java -classpath ${expectedClasspath} Main", +//]) + + +/* +assert log.getText().contains( "java -classpath $expectedClasspath Main" ) + +expectedClasspath = "customdir-before${File.pathSeparator}${new File(basedir, 'target/classes').getAbsolutePath()}" +assert log.getText().contains( "java -classpath $expectedClasspath Main" ) + +expectedClasspath = "${new File(basedir, 'target/classes').getAbsolutePath()}${File.pathSeparator}customdir-after" +assert log.getText().contains( "java -classpath $expectedClasspath Main" ) + +expectedClasspath = "customdir-before${File.pathSeparator}${new File(basedir, 'target/classes').getAbsolutePath()}${File.pathSeparator}customdir-after" +assert log.getText().contains( "java -classpath $expectedClasspath Main" ) + + + */ \ No newline at end of file diff -Nru exec-maven-plugin-1.1.1+dfsg/src/it/mexec-70/invoker.properties exec-maven-plugin-1.6.0/src/it/mexec-70/invoker.properties --- exec-maven-plugin-1.1.1+dfsg/src/it/mexec-70/invoker.properties 1970-01-01 00:00:00.000000000 +0000 +++ exec-maven-plugin-1.6.0/src/it/mexec-70/invoker.properties 2017-03-02 20:58:24.000000000 +0000 @@ -0,0 +1,2 @@ +invoker.goals = clean process-classes +invoker.debug = true \ No newline at end of file diff -Nru exec-maven-plugin-1.1.1+dfsg/src/it/mexec-70/pom.xml exec-maven-plugin-1.6.0/src/it/mexec-70/pom.xml --- exec-maven-plugin-1.1.1+dfsg/src/it/mexec-70/pom.xml 1970-01-01 00:00:00.000000000 +0000 +++ exec-maven-plugin-1.6.0/src/it/mexec-70/pom.xml 2017-03-02 20:58:24.000000000 +0000 @@ -0,0 +1,40 @@ + + + 4.0.0 + + + org.codehaus.mojo.exec.it + parent + 0.1 + + + mexec-70 + 0.0.1-SNAPSHOT + + + + + org.codehaus.mojo + exec-maven-plugin + @project.version@ + + + process-classes + + exec + + + ${JAVA_HOME}/bin/java + + -classpath + + Main + + + + + + + + diff -Nru exec-maven-plugin-1.1.1+dfsg/src/it/mexec-70/src/main/java/Main.java exec-maven-plugin-1.6.0/src/it/mexec-70/src/main/java/Main.java --- exec-maven-plugin-1.1.1+dfsg/src/it/mexec-70/src/main/java/Main.java 1970-01-01 00:00:00.000000000 +0000 +++ exec-maven-plugin-1.6.0/src/it/mexec-70/src/main/java/Main.java 2017-03-02 20:58:24.000000000 +0000 @@ -0,0 +1,10 @@ +import java.io.FileWriter; +import java.io.Writer; +import java.net.URL; + +public class Main +{ + public static void main( String[] args ) throws Exception + { + } +} diff -Nru exec-maven-plugin-1.1.1+dfsg/src/it/mexec-70/verify.groovy exec-maven-plugin-1.6.0/src/it/mexec-70/verify.groovy --- exec-maven-plugin-1.1.1+dfsg/src/it/mexec-70/verify.groovy 1970-01-01 00:00:00.000000000 +0000 +++ exec-maven-plugin-1.6.0/src/it/mexec-70/verify.groovy 2017-03-02 20:58:24.000000000 +0000 @@ -0,0 +1,21 @@ +/* + * 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 log = new File(basedir, 'build.log') +assert log.exists() +assert log.getText().contains( "java, -classpath, ${new File(basedir, 'target/classes').getAbsolutePath()}, Main") diff -Nru exec-maven-plugin-1.1.1+dfsg/src/it/mexec-73/invoker.properties exec-maven-plugin-1.6.0/src/it/mexec-73/invoker.properties --- exec-maven-plugin-1.1.1+dfsg/src/it/mexec-73/invoker.properties 1970-01-01 00:00:00.000000000 +0000 +++ exec-maven-plugin-1.6.0/src/it/mexec-73/invoker.properties 2017-03-02 20:58:24.000000000 +0000 @@ -0,0 +1,2 @@ +invoker.goals = clean process-classes +invoker.debug = true \ No newline at end of file diff -Nru exec-maven-plugin-1.1.1+dfsg/src/it/mexec-73/pom.xml exec-maven-plugin-1.6.0/src/it/mexec-73/pom.xml --- exec-maven-plugin-1.1.1+dfsg/src/it/mexec-73/pom.xml 1970-01-01 00:00:00.000000000 +0000 +++ exec-maven-plugin-1.6.0/src/it/mexec-73/pom.xml 2017-03-02 20:58:24.000000000 +0000 @@ -0,0 +1,43 @@ + + + 4.0.0 + + + org.codehaus.mojo.exec.it + parent + 0.1 + + + mexec-73 + 0.0.1-SNAPSHOT + + + + + org.codehaus.mojo + exec-maven-plugin + @project.version@ + + + equals-classpath + process-classes + + java + + + Main + + etc/run1 + etc/run2 + + + + + + java + + + + + diff -Nru exec-maven-plugin-1.1.1+dfsg/src/it/mexec-73/src/main/java/Main.java exec-maven-plugin-1.6.0/src/it/mexec-73/src/main/java/Main.java --- exec-maven-plugin-1.1.1+dfsg/src/it/mexec-73/src/main/java/Main.java 1970-01-01 00:00:00.000000000 +0000 +++ exec-maven-plugin-1.6.0/src/it/mexec-73/src/main/java/Main.java 2017-03-02 20:58:24.000000000 +0000 @@ -0,0 +1,10 @@ +import java.io.FileWriter; +import java.io.Writer; +import java.net.URL; + +public class Main +{ + public static void main( String[] args ) throws Exception + { + } +} diff -Nru exec-maven-plugin-1.1.1+dfsg/src/it/mexec-73/verify.groovy exec-maven-plugin-1.6.0/src/it/mexec-73/verify.groovy --- exec-maven-plugin-1.1.1+dfsg/src/it/mexec-73/verify.groovy 1970-01-01 00:00:00.000000000 +0000 +++ exec-maven-plugin-1.6.0/src/it/mexec-73/verify.groovy 2017-03-02 20:58:24.000000000 +0000 @@ -0,0 +1,42 @@ +/* + * 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 log = new File(basedir, 'build.log') +assert log.exists() + +String expectedClasspath = new File(basedir, 'target/classes').toURI().toURL().toString() +assert log.getText().contains( "Adding to classpath : $expectedClasspath" ) + +expectedClasspath = new File(basedir, 'etc/run1').toURI().toURL().toString() +assert log.getText().contains( "Adding additional classpath element: $expectedClasspath" ) + +expectedClasspath = new File(basedir, 'etc/run2').toURI().toURL().toString() +assert log.getText().contains( "Adding additional classpath element: $expectedClasspath" ) + +//expectedClasspath = new File("c:\\windows\\system32\\drivers\\etc").toURI().toURL().toString() +//assert log.getText().contains( "Adding additional classpath element: $expectedClasspath" ) + + +//expectedClasspath = "customdir-before${File.pathSeparator}${new File(basedir, 'target/classes').getAbsolutePath()}" +//assert log.getText().contains( "java -classpath $expectedClasspath Main" ) + +//expectedClasspath = "${new File(basedir, 'target/classes').getAbsolutePath()}${File.pathSeparator}customdir-after" +//assert log.getText().contains( "java -classpath $expectedClasspath Main" ) + +//expectedClasspath = "customdir-before${File.pathSeparator}${new File(basedir, 'target/classes').getAbsolutePath()}${File.pathSeparator}customdir-after" +//assert log.getText().contains( "java -classpath $expectedClasspath Main" ) \ No newline at end of file diff -Nru exec-maven-plugin-1.1.1+dfsg/src/it/mexec-79/invoker.properties exec-maven-plugin-1.6.0/src/it/mexec-79/invoker.properties --- exec-maven-plugin-1.1.1+dfsg/src/it/mexec-79/invoker.properties 1970-01-01 00:00:00.000000000 +0000 +++ exec-maven-plugin-1.6.0/src/it/mexec-79/invoker.properties 2017-03-02 20:58:24.000000000 +0000 @@ -0,0 +1,2 @@ +invoker.goals = clean process-classes +invoker.localRepositoryPath = ${project.build.directory}/Document and Settings/it-repo \ No newline at end of file diff -Nru exec-maven-plugin-1.1.1+dfsg/src/it/mexec-79/pom.xml exec-maven-plugin-1.6.0/src/it/mexec-79/pom.xml --- exec-maven-plugin-1.1.1+dfsg/src/it/mexec-79/pom.xml 1970-01-01 00:00:00.000000000 +0000 +++ exec-maven-plugin-1.6.0/src/it/mexec-79/pom.xml 2017-03-02 20:58:24.000000000 +0000 @@ -0,0 +1,39 @@ + + + 4.0.0 + + + org.codehaus.mojo.exec.it + parent + 0.1 + + + org.codehaus.mojo.exec-maven-plugin + mexec-79 + 0.0.1-SNAPSHOT + + + target or build + + target or build/classes + + + org.codehaus.mojo + exec-maven-plugin + @pom.version@ + + + process-classes + + java + + + Main + + + + + + + diff -Nru exec-maven-plugin-1.1.1+dfsg/src/it/mexec-79/src/main/java/Main.java exec-maven-plugin-1.6.0/src/it/mexec-79/src/main/java/Main.java --- exec-maven-plugin-1.1.1+dfsg/src/it/mexec-79/src/main/java/Main.java 1970-01-01 00:00:00.000000000 +0000 +++ exec-maven-plugin-1.6.0/src/it/mexec-79/src/main/java/Main.java 2017-03-02 20:58:24.000000000 +0000 @@ -0,0 +1,18 @@ +import java.io.FileWriter; +import java.io.Writer; +import java.net.URL; + +public class Main +{ + public static void main( String[] args ) throws Exception + { + URL url = Main.class.getClassLoader().getResource( "messages.properties" ); + Writer writer = new FileWriter( "exec.log" ); + try { + writer.write( url.toString() ); + } + finally { + writer.close(); + } + } +} diff -Nru exec-maven-plugin-1.1.1+dfsg/src/it/mexec-79/src/main/resources/messages.properties exec-maven-plugin-1.6.0/src/it/mexec-79/src/main/resources/messages.properties --- exec-maven-plugin-1.1.1+dfsg/src/it/mexec-79/src/main/resources/messages.properties 1970-01-01 00:00:00.000000000 +0000 +++ exec-maven-plugin-1.6.0/src/it/mexec-79/src/main/resources/messages.properties 2017-03-02 20:58:24.000000000 +0000 @@ -0,0 +1 @@ +language = en \ No newline at end of file diff -Nru exec-maven-plugin-1.1.1+dfsg/src/it/mexec-79/verify.groovy exec-maven-plugin-1.6.0/src/it/mexec-79/verify.groovy --- exec-maven-plugin-1.1.1+dfsg/src/it/mexec-79/verify.groovy 1970-01-01 00:00:00.000000000 +0000 +++ exec-maven-plugin-1.6.0/src/it/mexec-79/verify.groovy 2017-03-02 20:58:24.000000000 +0000 @@ -0,0 +1,21 @@ +/* + * 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 log = new File(basedir, 'exec.log') + assert log.exists() + assert log.getText().contains('target%20or%20build') diff -Nru exec-maven-plugin-1.1.1+dfsg/src/it/mexec-86/invoker.properties exec-maven-plugin-1.6.0/src/it/mexec-86/invoker.properties --- exec-maven-plugin-1.1.1+dfsg/src/it/mexec-86/invoker.properties 1970-01-01 00:00:00.000000000 +0000 +++ exec-maven-plugin-1.6.0/src/it/mexec-86/invoker.properties 2017-03-02 20:58:24.000000000 +0000 @@ -0,0 +1 @@ +invoker.goals = clean process-classes \ No newline at end of file diff -Nru exec-maven-plugin-1.1.1+dfsg/src/it/mexec-86/pom.xml exec-maven-plugin-1.6.0/src/it/mexec-86/pom.xml --- exec-maven-plugin-1.1.1+dfsg/src/it/mexec-86/pom.xml 1970-01-01 00:00:00.000000000 +0000 +++ exec-maven-plugin-1.6.0/src/it/mexec-86/pom.xml 2017-03-02 20:58:24.000000000 +0000 @@ -0,0 +1,41 @@ + + + 4.0.0 + + + org.codehaus.mojo.exec.it + parent + 0.1 + + + mexec-86 + 0.0.1-SNAPSHOT + + + + + org.codehaus.mojo + exec-maven-plugin + @pom.version@ + + + process-classes + + exec + + + ${project.build.directory}/out.log + ${JAVA_HOME}/bin/java + + -cp + target/classes + Main + + + + + + + + diff -Nru exec-maven-plugin-1.1.1+dfsg/src/it/mexec-86/src/main/java/Main.java exec-maven-plugin-1.6.0/src/it/mexec-86/src/main/java/Main.java --- exec-maven-plugin-1.1.1+dfsg/src/it/mexec-86/src/main/java/Main.java 1970-01-01 00:00:00.000000000 +0000 +++ exec-maven-plugin-1.6.0/src/it/mexec-86/src/main/java/Main.java 2017-03-02 20:58:24.000000000 +0000 @@ -0,0 +1,15 @@ +import java.io.FileWriter; +import java.io.Writer; +import java.net.URL; + +public class Main +{ + public static void main( String[] args ) throws Exception + { + System.out.println( "1. System.out line" ); + System.err.println( "2. System.err line" ); + System.out.println( "3. System.out line" ); + System.err.println( "4. System.err line" ); + System.out.println( "5. System.out line" ); + } +} diff -Nru exec-maven-plugin-1.1.1+dfsg/src/it/mexec-86/verify.groovy exec-maven-plugin-1.6.0/src/it/mexec-86/verify.groovy --- exec-maven-plugin-1.1.1+dfsg/src/it/mexec-86/verify.groovy 1970-01-01 00:00:00.000000000 +0000 +++ exec-maven-plugin-1.6.0/src/it/mexec-86/verify.groovy 2017-03-02 20:58:24.000000000 +0000 @@ -0,0 +1,109 @@ +/* + * 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. + */ + + +// The problem of this integration test was that +// it is not predictable to know if everything +// is written continuously into the file one +// line after the other. +// Based on the async behaviour it could happen +// that a new line is written earlier than +// some content from one other stream (stderr/stdout). +// +// So i had to find a way to ignore the above. +// The simplest solution was to just +// find the content line like "1. System.out line" +// which means the string of bytes which represents +// the line but not the ending NEW LINE (0x0a). +// +// The assumption in that IT is that +// the line "1. System.out line" is written +// continuously without any break in it. +// Otherwise this test will fail. + +import org.codehaus.plexus.util.FileUtils +import org.codehaus.plexus.util.IOUtil + +import java.io.* +import java.util.* + +import static junit.framework.Assert.assertEquals +import static junit.framework.Assert.assertTrue + +private int countTheNumberOfLines(String expectedHexString, String line) { + int numberOfLine = 0; + + boolean found = true; + while (found) { + int posOfFirstLine = expectedHexString.indexOf(line); + if (posOfFirstLine >= 0) { + found = true; + numberOfLine++; + // line.length(): + // +2 for hex means two character like 0a + // +1 for space during the hex string generation. + // depends on the platform. + expectedHexString = expectedHexString.substring(posOfFirstLine+line.length()); + } else { + found = false; + } + } + + return numberOfLine; +} + +private String convertStringToHex(String expectedOutput) { + StringBuilder result = new StringBuilder(); + for (int i = 0; i < expectedOutput.length(); i++) { + byte c = (byte) expectedOutput.charAt(i); + result.append(String.format("%02x", c)); + result.append(' '); + } + return result.toString(); +} + + +def outLog = new File(basedir, 'target/out.log') + +if (!outLog.exists()) { + throw new FileNotFoundException( "Could not find the " + outLog ); +} + +def expectedOutput = FileUtils.fileRead(outLog) + +def expectedHexString = convertStringToHex(expectedOutput); + +def expectedLines = [ + "1. System.out line", + "2. System.err line", + "3. System.out line", + "4. System.err line", + "5. System.out line", +] + +for (int i = 0; i < expectedLines.size(); i++) { + def expectedLine = convertStringToHex(expectedLines[i]); + assertTrue(expectedHexString.contains((expectedLine))); +} + +def LINE = System.getProperty("line.separator"); +def LineInHex = convertStringToHex(LINE); + +def numberOfLine = countTheNumberOfLines(expectedHexString, LineInHex); +assertEquals(5, numberOfLine); diff -Nru exec-maven-plugin-1.1.1+dfsg/src/it/mexec-88/invoker.properties exec-maven-plugin-1.6.0/src/it/mexec-88/invoker.properties --- exec-maven-plugin-1.1.1+dfsg/src/it/mexec-88/invoker.properties 1970-01-01 00:00:00.000000000 +0000 +++ exec-maven-plugin-1.6.0/src/it/mexec-88/invoker.properties 2017-03-02 20:58:24.000000000 +0000 @@ -0,0 +1 @@ +invoker.goals = clean process-classes \ No newline at end of file diff -Nru exec-maven-plugin-1.1.1+dfsg/src/it/mexec-88/pom.xml exec-maven-plugin-1.6.0/src/it/mexec-88/pom.xml --- exec-maven-plugin-1.1.1+dfsg/src/it/mexec-88/pom.xml 1970-01-01 00:00:00.000000000 +0000 +++ exec-maven-plugin-1.6.0/src/it/mexec-88/pom.xml 2017-03-02 20:58:24.000000000 +0000 @@ -0,0 +1,43 @@ + + + 4.0.0 + + + org.codehaus.mojo.exec.it + parent + 0.1 + + + mexec-88 + 0.0.1-SNAPSHOT + + + + + org.codehaus.mojo + exec-maven-plugin + @pom.version@ + + + process-classes + + exec + + + + + ${JAVA_HOME}/bin/java + + -classpath + + org.codehaus.mojo.exec.Main + + + 5 + + + + + + diff -Nru exec-maven-plugin-1.1.1+dfsg/src/it/mexec-88/src/main/java/org/codehaus/mojo/exec/Main.java exec-maven-plugin-1.6.0/src/it/mexec-88/src/main/java/org/codehaus/mojo/exec/Main.java --- exec-maven-plugin-1.1.1+dfsg/src/it/mexec-88/src/main/java/org/codehaus/mojo/exec/Main.java 1970-01-01 00:00:00.000000000 +0000 +++ exec-maven-plugin-1.6.0/src/it/mexec-88/src/main/java/org/codehaus/mojo/exec/Main.java 2017-03-02 20:58:24.000000000 +0000 @@ -0,0 +1,27 @@ +package org.codehaus.mojo.exec; + +/* + * Copyright 2005-2008 The Codehaus. + * + * 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. + */ + +public class Main +{ + + public static void main( String[] args ) + throws Exception + { + System.exit( 5 ); + } +} diff -Nru exec-maven-plugin-1.1.1+dfsg/src/it/mexec-92/invoker.properties exec-maven-plugin-1.6.0/src/it/mexec-92/invoker.properties --- exec-maven-plugin-1.1.1+dfsg/src/it/mexec-92/invoker.properties 1970-01-01 00:00:00.000000000 +0000 +++ exec-maven-plugin-1.6.0/src/it/mexec-92/invoker.properties 2017-03-02 20:58:24.000000000 +0000 @@ -0,0 +1 @@ +invoker.goals = clean exec:exec \ No newline at end of file diff -Nru exec-maven-plugin-1.1.1+dfsg/src/it/mexec-92/java/dummy.txt exec-maven-plugin-1.6.0/src/it/mexec-92/java/dummy.txt --- exec-maven-plugin-1.1.1+dfsg/src/it/mexec-92/java/dummy.txt 1970-01-01 00:00:00.000000000 +0000 +++ exec-maven-plugin-1.6.0/src/it/mexec-92/java/dummy.txt 2017-03-02 20:58:24.000000000 +0000 @@ -0,0 +1 @@ +Just to be sure the java folder is checked out \ No newline at end of file diff -Nru exec-maven-plugin-1.1.1+dfsg/src/it/mexec-92/pom.xml exec-maven-plugin-1.6.0/src/it/mexec-92/pom.xml --- exec-maven-plugin-1.1.1+dfsg/src/it/mexec-92/pom.xml 1970-01-01 00:00:00.000000000 +0000 +++ exec-maven-plugin-1.6.0/src/it/mexec-92/pom.xml 2017-03-02 20:58:24.000000000 +0000 @@ -0,0 +1,30 @@ + + + 4.0.0 + + + org.codehaus.mojo.exec.it + parent + 0.1 + + + mexec-92 + 0.0.1-SNAPSHOT + + + + + org.codehaus.mojo + exec-maven-plugin + @pom.version@ + + ${JAVA_HOME}/bin/java + + -version + + + + + + diff -Nru exec-maven-plugin-1.1.1+dfsg/src/it/mexec-98/invoker.properties exec-maven-plugin-1.6.0/src/it/mexec-98/invoker.properties --- exec-maven-plugin-1.1.1+dfsg/src/it/mexec-98/invoker.properties 1970-01-01 00:00:00.000000000 +0000 +++ exec-maven-plugin-1.6.0/src/it/mexec-98/invoker.properties 2017-03-02 20:58:24.000000000 +0000 @@ -0,0 +1,2 @@ +invoker.goals = clean process-classes +invoker.buildResult = failure \ No newline at end of file diff -Nru exec-maven-plugin-1.1.1+dfsg/src/it/mexec-98/pom.xml exec-maven-plugin-1.6.0/src/it/mexec-98/pom.xml --- exec-maven-plugin-1.1.1+dfsg/src/it/mexec-98/pom.xml 1970-01-01 00:00:00.000000000 +0000 +++ exec-maven-plugin-1.6.0/src/it/mexec-98/pom.xml 2017-03-02 20:58:24.000000000 +0000 @@ -0,0 +1,35 @@ + + + 4.0.0 + + + org.codehaus.mojo.exec.it + parent + 0.1 + + + mexec-98 + 0.0.1-SNAPSHOT + + + + + org.codehaus.mojo + exec-maven-plugin + @pom.version@ + + + process-classes + + java + + + + + org.codehaus.mojo.exec.Main + + + + + diff -Nru exec-maven-plugin-1.1.1+dfsg/src/it/mexec-98/src/main/java/org/codehaus/mojo/exec/Main.java exec-maven-plugin-1.6.0/src/it/mexec-98/src/main/java/org/codehaus/mojo/exec/Main.java --- exec-maven-plugin-1.1.1+dfsg/src/it/mexec-98/src/main/java/org/codehaus/mojo/exec/Main.java 1970-01-01 00:00:00.000000000 +0000 +++ exec-maven-plugin-1.6.0/src/it/mexec-98/src/main/java/org/codehaus/mojo/exec/Main.java 2017-03-02 20:58:24.000000000 +0000 @@ -0,0 +1,10 @@ +package org.codehaus.mojo.exec; + +public class Main +{ + + // Watch it: no static!! + public void main( String[] args ) + { + } +} diff -Nru exec-maven-plugin-1.1.1+dfsg/src/it/mexec-98/verify.groovy exec-maven-plugin-1.6.0/src/it/mexec-98/verify.groovy --- exec-maven-plugin-1.1.1+dfsg/src/it/mexec-98/verify.groovy 1970-01-01 00:00:00.000000000 +0000 +++ exec-maven-plugin-1.6.0/src/it/mexec-98/verify.groovy 2017-03-02 20:58:24.000000000 +0000 @@ -0,0 +1,21 @@ +/* + * 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 log = new File(basedir, 'build.log') +assert log.exists() +assert log.getText().contains( "Can't call main(String[])-method because it is not static.") \ No newline at end of file diff -Nru exec-maven-plugin-1.1.1+dfsg/src/it/multiple-executions/invoker.properties exec-maven-plugin-1.6.0/src/it/multiple-executions/invoker.properties --- exec-maven-plugin-1.1.1+dfsg/src/it/multiple-executions/invoker.properties 1970-01-01 00:00:00.000000000 +0000 +++ exec-maven-plugin-1.6.0/src/it/multiple-executions/invoker.properties 2017-03-02 20:58:24.000000000 +0000 @@ -0,0 +1 @@ +invoker.goals = clean verify diff -Nru exec-maven-plugin-1.1.1+dfsg/src/it/multiple-executions/pom.xml exec-maven-plugin-1.6.0/src/it/multiple-executions/pom.xml --- exec-maven-plugin-1.1.1+dfsg/src/it/multiple-executions/pom.xml 1970-01-01 00:00:00.000000000 +0000 +++ exec-maven-plugin-1.6.0/src/it/multiple-executions/pom.xml 2017-03-02 20:58:24.000000000 +0000 @@ -0,0 +1,56 @@ + + 4.0.0 + + + org.codehaus.mojo.exec.it + parent + 0.1 + + + multiple-execution + 0.0.1-SNAPSHOT + + + + + org.codehaus.mojo + exec-maven-plugin + @project.version@ + + ${JAVA_HOME}/bin/java + + -cp + target/classes + Main + + + + + first-execution + + exec + + process-classes + + + second-execution + + exec + + test-compile + + + third-execution + + exec + + pre-integration-test + + + + + + diff -Nru exec-maven-plugin-1.1.1+dfsg/src/it/multiple-executions/src/main/java/Main.java exec-maven-plugin-1.6.0/src/it/multiple-executions/src/main/java/Main.java --- exec-maven-plugin-1.1.1+dfsg/src/it/multiple-executions/src/main/java/Main.java 1970-01-01 00:00:00.000000000 +0000 +++ exec-maven-plugin-1.6.0/src/it/multiple-executions/src/main/java/Main.java 2017-03-02 20:58:24.000000000 +0000 @@ -0,0 +1,15 @@ +import java.io.FileWriter; +import java.io.Writer; +import java.net.URL; + +public class Main +{ + public static void main( String[] args ) throws Exception + { + System.out.println( "1. System.out line" ); + System.err.println( "2. System.err line" ); + System.out.println( "3. System.out line" ); + System.err.println( "4. System.err line" ); + System.out.println( "5. System.out line" ); + } +} diff -Nru exec-maven-plugin-1.1.1+dfsg/src/it/multiple-executions/verify.groovy exec-maven-plugin-1.6.0/src/it/multiple-executions/verify.groovy --- exec-maven-plugin-1.1.1+dfsg/src/it/multiple-executions/verify.groovy 1970-01-01 00:00:00.000000000 +0000 +++ exec-maven-plugin-1.6.0/src/it/multiple-executions/verify.groovy 2017-03-02 20:58:24.000000000 +0000 @@ -0,0 +1,94 @@ +/* + * 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. + */ + +import java.io.* +import java.util.* + +t = new IntegrationBase() + +def buildLog = new File( basedir, "build.log" ) + +def getPluginVersion() { + def pom = new XmlSlurper().parse(new File(basedir, 'pom.xml')) + + def allPlugins = pom.build.plugins.plugin; + + def configurationMavenPlugin = allPlugins.find { + item -> item.groupId.equals("org.codehaus.mojo") && item.artifactId.equals("exec-maven-plugin"); + } + + return configurationMavenPlugin.version; +} + +def getProjectVersion() { + def pom = new XmlSlurper().parse(new File(basedir, 'pom.xml')) + + def allPlugins = pom.version; + + return pom.version; +} +def getMavenVersion(buildLog) { + def maven = null; + buildLog.eachLine { line -> + if (line.startsWith("Apache Maven 2.0.11")) { + maven = "2.0.11"; + } else if (line.startsWith("Apache Maven 2.2.1")) { + maven = "2.2.1"; + } else if (line.startsWith("Apache Maven 3.0.3")) { + maven = "3.0.3"; + } else if (line.startsWith("Apache Maven 3.0.4")) { + maven = "3.0.4"; + } else if (line.startsWith("Apache Maven 3.0.5")) { + maven = "3.0.5"; + } else if (line.startsWith("Apache Maven 3.1.0")) { + maven = "3.1.0"; + } else if (line.startsWith("Apache Maven 3.1.1")) { + maven = "3.1.1"; + } else if (line.startsWith("Apache Maven 3.2.1")) { + maven = "3.2.1"; + } + } + + return maven +} + +def mavenVersion = getMavenVersion(buildLog) + + +def projectVersion = getProjectVersion(); +def pluginVersion = getPluginVersion(); + +println "Project version: ${projectVersion}" +println "Plugin version ${pluginVersion}" + +if (mavenVersion.equals("2.0.11") || mavenVersion.equals("2.2.1")) { + t.checkExistenceAndContentOfAFile(buildLog, [ + "[DEBUG] (f) arguments = [-cp, target/classes, Main]", + "[INFO] [exec:exec {execution: first-execution}]", + "[INFO] [exec:exec {execution: second-execution}]", + "[INFO] [exec:exec {execution: third-execution}]", + ]) +} else { + t.checkExistenceAndContentOfAFile(buildLog, [ + "[DEBUG] (f) arguments = [-cp, target/classes, Main]", + "[INFO] --- exec-maven-plugin:" + pluginVersion + ":exec (first-execution) @ multiple-execution ---", + "[INFO] --- exec-maven-plugin:" + pluginVersion + ":exec (second-execution) @ multiple-execution ---", + "[INFO] --- exec-maven-plugin:" + pluginVersion + ":exec (third-execution) @ multiple-execution ---", + ]) +} diff -Nru exec-maven-plugin-1.1.1+dfsg/src/it/settings.xml exec-maven-plugin-1.6.0/src/it/settings.xml --- exec-maven-plugin-1.1.1+dfsg/src/it/settings.xml 1970-01-01 00:00:00.000000000 +0000 +++ exec-maven-plugin-1.6.0/src/it/settings.xml 2017-03-02 20:58:24.000000000 +0000 @@ -0,0 +1,63 @@ + + + + + + + + it-repo + RPM + @localRepositoryUrl@ + * + + + + + it-repo + + true + + + + local.central + @localRepositoryUrl@ + + true + + + true + + + + + + local.central + @localRepositoryUrl@ + + true + + + true + + + + + + diff -Nru exec-maven-plugin-1.1.1+dfsg/src/it/setup/invoker.properties exec-maven-plugin-1.6.0/src/it/setup/invoker.properties --- exec-maven-plugin-1.1.1+dfsg/src/it/setup/invoker.properties 1970-01-01 00:00:00.000000000 +0000 +++ exec-maven-plugin-1.6.0/src/it/setup/invoker.properties 2017-03-02 20:58:24.000000000 +0000 @@ -0,0 +1,7 @@ +invoker.name = Setup Integration Test Parent + +invoker.goals = install + +invoker.debug = true + +debug = true diff -Nru exec-maven-plugin-1.1.1+dfsg/src/it/setup/pom.xml exec-maven-plugin-1.6.0/src/it/setup/pom.xml --- exec-maven-plugin-1.1.1+dfsg/src/it/setup/pom.xml 1970-01-01 00:00:00.000000000 +0000 +++ exec-maven-plugin-1.6.0/src/it/setup/pom.xml 2017-03-02 20:58:24.000000000 +0000 @@ -0,0 +1,96 @@ + + + + 4.0.0 + + org.codehaus.mojo.exec.it + parent + 0.1 + + pom + + exec-maven-plugin + http://www.codehaus.org + + + + Apache License 2 + http://www.apache.org/licenses/LICENSE-2.0.txt + repo + + + + + UTF-8 + + + + + + commons-io + commons-io + 1.1 + + + commons-logging + commons-logging + 1.0.4 + + + + + + + + + org.apache.maven.plugins + maven-site-plugin + 2.0.1 + + + org.apache.maven.plugins + maven-surefire-plugin + 2.16 + + + org.apache.maven.plugins + maven-compiler-plugin + 3.1 + + + org.apache.maven.plugins + maven-clean-plugin + 2.5 + + + org.apache.maven.plugins + maven-assembly-plugin + 2.4 + + + org.apache.maven.plugins + maven-jar-plugin + 2.4 + + + org.apache.maven.plugins + maven-install-plugin + 2.4 + + + org.apache.maven.plugins + maven-war-plugin + 2.3 + + + org.apache.maven.plugins + maven-resources-plugin + 2.6 + + + + + diff -Nru exec-maven-plugin-1.1.1+dfsg/src/main/java/org/codehaus/mojo/exec/AbstractExecMojo.java exec-maven-plugin-1.6.0/src/main/java/org/codehaus/mojo/exec/AbstractExecMojo.java --- exec-maven-plugin-1.1.1+dfsg/src/main/java/org/codehaus/mojo/exec/AbstractExecMojo.java 2009-11-26 14:32:11.000000000 +0000 +++ exec-maven-plugin-1.6.0/src/main/java/org/codehaus/mojo/exec/AbstractExecMojo.java 2017-03-02 20:58:24.000000000 +0000 @@ -1,115 +1,190 @@ package org.codehaus.mojo.exec; /* - * Copyright 2006 The Codehaus. + * 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 * - * 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 * - * 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. + * 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. */ import java.io.File; - -import java.util.Iterator; -import java.util.LinkedList; import java.util.List; +import org.apache.maven.artifact.Artifact; +import org.apache.maven.model.Resource; +import org.apache.maven.artifact.factory.ArtifactFactory; +import org.apache.maven.artifact.metadata.ArtifactMetadataSource; +import org.apache.maven.artifact.repository.ArtifactRepository; +import org.apache.maven.artifact.resolver.ArtifactResolver; import org.apache.maven.plugin.AbstractMojo; import org.apache.maven.plugin.MojoExecutionException; +import org.apache.maven.plugins.annotations.Component; +import org.apache.maven.plugins.annotations.Parameter; import org.apache.maven.project.MavenProject; +import org.apache.maven.project.MavenProjectBuilder; +import org.codehaus.plexus.util.cli.CommandLineUtils; /** - * This class is used for unifying functionality between the 2 mojo exec plugins ('java' and 'exec'). - * It handles parsing the arguments and adding source/test folders. - * + * This class is used for unifying functionality between the 2 mojo exec plugins ('java' and 'exec'). It handles parsing + * the arguments and adding source/test folders. + * * @author Philippe Jacot (PJA) * @author Jerome Lacoste */ -public abstract class AbstractExecMojo extends AbstractMojo +public abstract class AbstractExecMojo + extends AbstractMojo { /** * The enclosing project. - * - * @parameter expression="${project}" - * @required - * @readonly */ + @Parameter( defaultValue = "${project}", readonly = true ) protected MavenProject project; + @Component + private ArtifactResolver artifactResolver; + + @Component + private ArtifactFactory artifactFactory; + + @Component + private MavenProjectBuilder projectBuilder; + + @Component + private ArtifactMetadataSource metadataSource; + + @Parameter( readonly = true, required = true, defaultValue = "${localRepository}" ) + private ArtifactRepository localRepository; + + @Parameter( readonly = true, required = true, defaultValue = "${project.remoteArtifactRepositories}" ) + private List remoteRepositories; + + @Parameter( readonly = true, defaultValue = "${plugin.artifacts}" ) + private List pluginDependencies; + /** - * This folder is added to the list of those folders - * containing source to be compiled. Use this if your - * plugin generates source code. + * If provided the ExecutableDependency identifies which of the plugin dependencies contains the executable class. + * This will have the affect of only including plugin dependencies required by the identified ExecutableDependency. * - * @parameter expression="${sourceRoot}" + *

+ * If includeProjectDependencies is set to true, all of the project dependencies will be included on + * the executable's classpath. Whether a particular project dependency is a dependency of the identified + * ExecutableDependency will be irrelevant to its inclusion in the classpath. + *

+ * + * @since 1.1-beta-1 */ + @Parameter + protected ExecutableDependency executableDependency; + + /** + * This folder is added to the list of those folders containing source to be compiled. Use this if your plugin + * generates source code. + */ + @Parameter( property = "sourceRoot" ) private File sourceRoot; /** - * This folder is added to the list of those folders - * containing source to be compiled for testing. Use this if your + * This folder is added to the list of those folders containing source to be compiled for testing. Use this if your * plugin generates test source code. - * - * @parameter expression="${testSourceRoot}" */ + @Parameter( property = "testSourceRoot" ) private File testSourceRoot; /** - * Arguments for the executed program - * - * @parameter expression="${exec.args}" + * Arguments separated by space for the executed program. For example: "-j 20" */ + @Parameter( property = "exec.args" ) private String commandlineArgs; - + /** - * Defines the scope of the classpath passed to the plugin. Set to compile,test,runtime or system depending - * on your needs. - * @parameter expression="${exec.classpathScope}" default-value="compile" + * Defines the scope of the classpath passed to the plugin. Set to compile,test,runtime or system depending on your + * needs. Since 1.1.2, the default value is 'runtime' instead of 'compile'. */ + @Parameter( property = "exec.classpathScope", defaultValue = "runtime" ) protected String classpathScope; - /** @see #parseCommandlineArgs */ - private static final char PARAMETER_DELIMITER = ' '; + /** + * Skip the execution. Starting with version 1.4.0 the former name skip has been changed into + * exec.skip. + * + * @since 1.0.1 + */ + // TODO: Remove the alias in version 1.5.0 of the plugin. + @Parameter( property = "exec.skip", defaultValue = "false", alias = "skip" ) + private boolean skip; - /** @see #parseCommandlineArgs */ - private static final char STRING_WRAPPER = '"'; + /** + * Add project resource directories to classpath. This is especially useful if the exec plugin is used for a code + * generator that reads its settings from the classpath. + * + * @since 1.5.1 + */ + @Parameter( property = "addResourcesToClasspath", defaultValue = "false" ) + private boolean addResourcesToClasspath; - /** @see #parseCommandlineArgs */ - private static final char ESCAPE_CHAR = '\\'; + /** + * Add project output directory to classpath. This might be undesirable when the exec plugin is run before the + * compile step. Default is true. + * + * @since 1.5.1 + */ + @Parameter( property = "addOutputToClasspath", defaultValue = "true" ) + private boolean addOutputToClasspath; /** - * Collects the project artifacts in the specified List and the project specific classpath - * (build output and build test output) Files in the specified List, depending on the plugin classpathScope value. + * Collects the project artifacts in the specified List and the project specific classpath (build output and build + * test output) Files in the specified List, depending on the plugin classpathScope value. + * * @param artifacts the list where to collect the scope specific artifacts * @param theClasspathFiles the list where to collect the scope specific output directories - * @throws NullPointerException if at least one of the parameter is null */ - protected void collectProjectArtifactsAndClasspath( List artifacts, List theClasspathFiles ) + @SuppressWarnings( "unchecked" ) + protected void collectProjectArtifactsAndClasspath( List artifacts, List theClasspathFiles ) { - + if ( addResourcesToClasspath ) + { + for ( Resource r : project.getBuild().getResources() ) + { + theClasspathFiles.add( new File( r.getDirectory() ) ); + } + } + if ( "compile".equals( classpathScope ) ) { artifacts.addAll( project.getCompileArtifacts() ); - theClasspathFiles.add( new File( project.getBuild().getOutputDirectory() ) ); + if ( addOutputToClasspath ) + { + theClasspathFiles.add( new File( project.getBuild().getOutputDirectory() ) ); + } } else if ( "test".equals( classpathScope ) ) { artifacts.addAll( project.getTestArtifacts() ); - theClasspathFiles.add( new File( project.getBuild().getTestOutputDirectory() ) ); - theClasspathFiles.add( new File( project.getBuild().getOutputDirectory() ) ); + if ( addOutputToClasspath ) + { + theClasspathFiles.add( new File( project.getBuild().getTestOutputDirectory() ) ); + theClasspathFiles.add( new File( project.getBuild().getOutputDirectory() ) ); + } } else if ( "runtime".equals( classpathScope ) ) { artifacts.addAll( project.getRuntimeArtifacts() ); - theClasspathFiles.add( new File( project.getBuild().getOutputDirectory() ) ); + if ( addOutputToClasspath ) + { + theClasspathFiles.add( new File( project.getBuild().getOutputDirectory() ) ); + } } else if ( "system".equals( classpathScope ) ) { @@ -128,98 +203,28 @@ * Parses the argument string given by the user. Strings are recognized as everything between STRING_WRAPPER. * PARAMETER_DELIMITER is ignored inside a string. STRING_WRAPPER and PARAMETER_DELIMITER can be escaped using * ESCAPE_CHAR. - * + * * @return Array of String representing the arguments - * @throws MojoExecutionException - * for wrong formatted arguments + * @throws MojoExecutionException for wrong formatted arguments */ - protected String[] parseCommandlineArgs() throws MojoExecutionException + protected String[] parseCommandlineArgs() + throws MojoExecutionException { if ( commandlineArgs == null ) { return null; } - - boolean inString = false; - String arguments = commandlineArgs.trim(); - - List argumentList = new LinkedList(); - - int chr = 0; - char curChar; - StringBuffer arg = new StringBuffer(); - while ( chr < arguments.length() ) + else { - curChar = arguments.charAt( chr ); - if ( curChar == ESCAPE_CHAR ) - { - // A char is escaped, replace and skip one char - if ( arguments.length() == chr + 1 ) - { - // ESCAPE_CHAR is the last character... this should be an error (?) - // char is just ignored by now - getLog().warn( ESCAPE_CHAR - + " was the last character in your command line arguments. Verify your parameters." ); - } - else - { - // In a string only STRING_WRAPPER is escaped - if ( !inString || arguments.charAt( chr + 1 ) == STRING_WRAPPER ) - { - chr++; - } - - arg.append( arguments.charAt( chr ) ); - } - } - else if ( curChar == PARAMETER_DELIMITER && !inString ) + try { - // Next parameter begins here - argumentList.add( arg.toString() ); - arg.delete( 0, arg.length() ); + return CommandLineUtils.translateCommandline( commandlineArgs ); } - else if ( curChar == STRING_WRAPPER ) + catch ( Exception e ) { - // Entering or leaving a string - inString = !inString; + throw new MojoExecutionException( e.getMessage() ); } - else - { - // Append this char to the current parameter - arg.append( curChar ); - } - - chr++; - } - if ( inString ) - { - // Error string not terminated - throw new MojoExecutionException( "args contains not properly formatted string" ); } - else - { - // Append last parameter - argumentList.add( arg.toString() ); - } - - Iterator it = argumentList.listIterator(); - String[] result = new String[argumentList.size()]; - int index = 0; - while ( it.hasNext() ) - { - result[index] = (String) it.next(); - index++; - } - - getLog().debug( "Args:" ); - it = argumentList.listIterator(); - while ( it.hasNext() ) - { - getLog().debug( " <" + (String) it.next() + ">" ); - } - getLog().debug( " parsed from <" + commandlineArgs + ">" ); - - return result; } /** @@ -248,4 +253,43 @@ } } + /** + * Check if the execution should be skipped + * + * @return true to skip + */ + protected boolean isSkip() + { + return skip; + } + + /** + * Examine the plugin dependencies to find the executable artifact. + * + * @return an artifact which refers to the actual executable tool (not a POM) + * @throws MojoExecutionException if no executable artifact was found + */ + protected Artifact findExecutableArtifact() + throws MojoExecutionException + { + // ILimitedArtifactIdentifier execToolAssembly = this.getExecutableToolAssembly(); + + Artifact executableTool = null; + for ( Artifact pluginDep : this.pluginDependencies ) + { + if ( this.executableDependency.matches( pluginDep ) ) + { + executableTool = pluginDep; + break; + } + } + + if ( executableTool == null ) + { + throw new MojoExecutionException( "No dependency of the plugin matches the specified executableDependency." + + " Specified executableToolAssembly is: " + executableDependency.toString() ); + } + + return executableTool; + } } diff -Nru exec-maven-plugin-1.1.1+dfsg/src/main/java/org/codehaus/mojo/exec/AbstractPath.java exec-maven-plugin-1.6.0/src/main/java/org/codehaus/mojo/exec/AbstractPath.java --- exec-maven-plugin-1.1.1+dfsg/src/main/java/org/codehaus/mojo/exec/AbstractPath.java 1970-01-01 00:00:00.000000000 +0000 +++ exec-maven-plugin-1.6.0/src/main/java/org/codehaus/mojo/exec/AbstractPath.java 2017-03-02 20:58:24.000000000 +0000 @@ -0,0 +1,69 @@ +package org.codehaus.mojo.exec; + +/* + * 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. + */ + +import java.util.Collection; + +abstract class AbstractPath +{ + + /** + * @parameter dependency + */ + private Collection dependencies; + + public void setDependencies( Collection deps ) + { + this.dependencies = deps; + } + + public void setDependency( String dependency ) + { + // Is the the correct thing to do? See MOJO-348 + if ( dependencies == null ) + { + setDependencies( new java.util.ArrayList() ); + } + dependencies.add( dependency ); + } + + public Collection getDependencies() + { + return dependencies; + } + + public String toString() + { + StringBuilder buffer = new StringBuilder( "Classpath {" ); + + if ( dependencies != null ) + { + for ( String dep : dependencies ) + { + buffer.append( " " ).append( dep ); + } + } + + buffer.append( "}" ); + + return buffer.toString(); + } + +} diff -Nru exec-maven-plugin-1.1.1+dfsg/src/main/java/org/codehaus/mojo/exec/Classpath.java exec-maven-plugin-1.6.0/src/main/java/org/codehaus/mojo/exec/Classpath.java --- exec-maven-plugin-1.1.1+dfsg/src/main/java/org/codehaus/mojo/exec/Classpath.java 2009-11-26 14:32:11.000000000 +0000 +++ exec-maven-plugin-1.6.0/src/main/java/org/codehaus/mojo/exec/Classpath.java 2017-03-02 20:58:24.000000000 +0000 @@ -1,66 +1,27 @@ package org.codehaus.mojo.exec; /* - * Copyright 2005 The Codehaus. + * 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 * - * 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 * - * 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. + * 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. */ -import java.util.Collection; -import java.util.Iterator; - /** - * @author Jerome Lacoste + * @author Jerome Lacoste (jerome@coffeebreaks.org) */ -public class Classpath +public class Classpath extends AbstractPath { - /** - * @parameter dependency - */ - private Collection dependencies; - - public void setDependencies( Collection deps ) - { - this.dependencies = deps; - } - - public void setDependency( String dependency ) - { - // Is the the correct thing to do? See MOJO-348 - if ( dependencies == null ) - { - setDependencies( new java.util.ArrayList() ); - } - dependencies.add( dependency ); - } - - public Collection getDependencies() - { - return dependencies; - } - - public String toString() - { - StringBuffer buffer = new StringBuffer( "Classpath {" ); - - if ( dependencies != null ) - { - for ( Iterator it = dependencies.iterator(); it.hasNext(); ) - { - buffer.append( " " ).append( it.next() ); - } - } - buffer.append( "}" ); - return buffer.toString(); - } } diff -Nru exec-maven-plugin-1.1.1+dfsg/src/main/java/org/codehaus/mojo/exec/EnvStreamConsumer.java exec-maven-plugin-1.6.0/src/main/java/org/codehaus/mojo/exec/EnvStreamConsumer.java --- exec-maven-plugin-1.1.1+dfsg/src/main/java/org/codehaus/mojo/exec/EnvStreamConsumer.java 1970-01-01 00:00:00.000000000 +0000 +++ exec-maven-plugin-1.6.0/src/main/java/org/codehaus/mojo/exec/EnvStreamConsumer.java 2017-03-02 20:58:24.000000000 +0000 @@ -0,0 +1,49 @@ +package org.codehaus.mojo.exec; + +import java.util.HashMap; +import java.util.Map; + +import org.codehaus.plexus.util.StringUtils; +import org.codehaus.plexus.util.cli.StreamConsumer; + +public class EnvStreamConsumer + implements StreamConsumer +{ + + public static final String START_PARSING_INDICATOR = + "================================This is the beginning of env parsing================================"; + + private Map envs = new HashMap(); + + private boolean startParsing = false; + + public void consumeLine( String line ) + { + + if ( line.startsWith( START_PARSING_INDICATOR ) ) + { + this.startParsing = true; + return; + } + + if ( this.startParsing ) + { + String[] tokens = StringUtils.split( line, "=" ); + if ( tokens.length == 2 ) + { + envs.put( tokens[0], tokens[1] ); + } + } + else + { + System.out.println( line ); + } + + } + + public Map getParsedEnv() + { + return this.envs; + } + +} diff -Nru exec-maven-plugin-1.1.1+dfsg/src/main/java/org/codehaus/mojo/exec/ExecJavaMojo.java exec-maven-plugin-1.6.0/src/main/java/org/codehaus/mojo/exec/ExecJavaMojo.java --- exec-maven-plugin-1.1.1+dfsg/src/main/java/org/codehaus/mojo/exec/ExecJavaMojo.java 2009-11-26 14:32:11.000000000 +0000 +++ exec-maven-plugin-1.6.0/src/main/java/org/codehaus/mojo/exec/ExecJavaMojo.java 2017-03-02 20:58:24.000000000 +0000 @@ -1,35 +1,28 @@ package org.codehaus.mojo.exec; /* - * Copyright 2005-2006 The Codehaus. + * 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 * - * 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 * - * 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.x + * 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. */ -import org.apache.maven.artifact.Artifact; -import org.apache.maven.artifact.factory.ArtifactFactory; -import org.apache.maven.artifact.metadata.ArtifactMetadataSource; -import org.apache.maven.artifact.repository.ArtifactRepository; -import org.apache.maven.artifact.resolver.ArtifactResolutionResult; -import org.apache.maven.artifact.resolver.ArtifactResolver; -import org.apache.maven.plugin.MojoExecutionException; -import org.apache.maven.plugin.MojoFailureException; -import org.apache.maven.project.MavenProject; -import org.apache.maven.project.MavenProjectBuilder; -import org.apache.maven.project.artifact.MavenMetadataSource; - import java.io.File; +import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; +import java.lang.reflect.Modifier; import java.net.MalformedURLException; import java.net.URL; import java.net.URLClassLoader; @@ -37,208 +30,208 @@ import java.util.Collection; import java.util.Collections; import java.util.HashSet; -import java.util.Iterator; import java.util.List; import java.util.Properties; import java.util.Set; +import org.apache.maven.artifact.Artifact; +import org.apache.maven.artifact.factory.ArtifactFactory; +import org.apache.maven.artifact.metadata.ArtifactMetadataSource; +import org.apache.maven.artifact.repository.ArtifactRepository; +import org.apache.maven.artifact.resolver.ArtifactResolutionResult; +import org.apache.maven.artifact.resolver.ArtifactResolver; +import org.apache.maven.model.Dependency; +import org.apache.maven.plugin.MojoExecutionException; +import org.apache.maven.plugin.MojoFailureException; +import org.apache.maven.plugins.annotations.Component; +import org.apache.maven.plugins.annotations.Mojo; +import org.apache.maven.plugins.annotations.Parameter; +import org.apache.maven.plugins.annotations.ResolutionScope; +import org.apache.maven.project.MavenProject; +import org.apache.maven.project.MavenProjectBuilder; +import org.apache.maven.project.artifact.MavenMetadataSource; + /** - * Executes the supplied java class in the current VM with the enclosing project's - * dependencies as classpath. - * - * @author Kaare Nilsen, David Smiley - * @goal java - * @requiresDependencyResolution test - * @execute phase="validate" + * Executes the supplied java class in the current VM with the enclosing project's dependencies as classpath. + * + * @author Kaare Nilsen (kaare.nilsen@gmail.com), David Smiley (dsmiley@mitre.org) * @since 1.0 */ +@Mojo( name = "java", threadSafe = true, requiresDependencyResolution = ResolutionScope.TEST ) public class ExecJavaMojo extends AbstractExecMojo { - /** - * @component - */ + @Component private ArtifactResolver artifactResolver; - /** - * @component - */ + @Component private ArtifactFactory artifactFactory; - /** - * @component - */ + @Component private ArtifactMetadataSource metadataSource; /** - * @parameter expression="${localRepository}" - * @required - * @readonly * @since 1.0 */ + @Parameter( readonly = true, required = true, defaultValue = "${localRepository}" ) private ArtifactRepository localRepository; /** - * @parameter expression="${project.remoteArtifactRepositories}" - * @required - * @readonly * @since 1.1-beta-1 */ - private List remoteRepositories; + @Parameter( readonly = true, required = true, defaultValue = "${project.remoteArtifactRepositories}" ) + private List remoteRepositories; /** - * @component * @since 1.0 */ + @Component private MavenProjectBuilder projectBuilder; /** - * @parameter expression="${plugin.artifacts}" - * @readonly * @since 1.1-beta-1 */ - private List pluginDependencies; + @Parameter( readonly = true, defaultValue = "${plugin.artifacts}" ) + private List pluginDependencies; /** * The main class to execute. - * - * @parameter expression="${exec.mainClass}" - * @required + * * @since 1.0 */ + @Parameter( required = true, property = "exec.mainClass" ) private String mainClass; /** * The class arguments. - * - * @parameter expression="${exec.arguments}" + * * @since 1.0 */ + @Parameter( property = "exec.arguments" ) private String[] arguments; /** - * A list of system properties to be passed. Note: as the execution is not forked, some system properties - * required by the JVM cannot be passed here. Use MAVEN_OPTS or the exec:exec instead. See the user guide for - * more information. - * - * @parameter + * A list of system properties to be passed. Note: as the execution is not forked, some system properties required + * by the JVM cannot be passed here. Use MAVEN_OPTS or the exec:exec instead. See the user guide for more + * information. + * * @since 1.0 */ + @Parameter private Property[] systemProperties; /** - * Indicates if mojo should be kept running after the mainclass terminates. - * Usefull for serverlike apps with deamonthreads. - * - * @parameter expression="${exec.keepAlive}" default-value="false" + * Indicates if mojo should be kept running after the mainclass terminates. Use full for server like apps with + * daemon threads. + * * @deprecated since 1.1-alpha-1 * @since 1.0 */ + @Parameter( property = "exec.keepAlive", defaultValue = "false" ) + @Deprecated private boolean keepAlive; /** - * Indicates if the project dependencies should be used when executing - * the main class. - * - * @parameter expression="${exec.includeProjectDependencies}" default-value="true" + * Indicates if the project dependencies should be used when executing the main class. + * * @since 1.1-beta-1 */ + @Parameter( property = "exec.includeProjectDependencies", defaultValue = "true" ) private boolean includeProjectDependencies; /** - * Indicates if this plugin's dependencies should be used when executing - * the main class. + * Indicates if this plugin's dependencies should be used when executing the main class. *

- * This is useful when project dependencies are not appropriate. Using only - * the plugin dependencies can be particularly useful when the project is - * not a java project. For example a mvn project using the csharp plugins + * This is useful when project dependencies are not appropriate. Using only the plugin dependencies can be + * particularly useful when the project is not a java project. For example a mvn project using the csharp plugins * only expects to see dotnet libraries as dependencies. - * - * @parameter expression="${exec.includePluginDependencies}" default-value="false" + * * @since 1.1-beta-1 */ + @Parameter( property = "exec.includePluginsDependencies", defaultValue = "false" ) private boolean includePluginDependencies; /** - * If provided the ExecutableDependency identifies which of the plugin dependencies - * contains the executable class. This will have the affect of only including - * plugin dependencies required by the identified ExecutableDependency. - *

- * If includeProjectDependencies is set to true, all of the project dependencies - * will be included on the executable's classpath. Whether a particular project - * dependency is a dependency of the identified ExecutableDependency will be - * irrelevant to its inclusion in the classpath. - * - * @parameter - * @optional - * @since 1.1-beta-1 - */ - private ExecutableDependency executableDependency; - - /** - * Wether to interrupt/join and possibly stop the daemon threads upon quitting.
If this is false, - * maven does nothing about the daemon threads. When maven has no more work to do, the VM will normally terminate - * any remaining daemon threads. + * Whether to interrupt/join and possibly stop the daemon threads upon quitting.
+ * If this is false, maven does nothing about the daemon threads. When maven has no more work to do, + * the VM will normally terminate any remaining daemon threads. *

- * In certain cases (in particular if maven is embedded), - * you might need to keep this enabled to make sure threads are properly cleaned up to ensure they don't interfere - * with subsequent activity. - * In that case, see {@link #daemonThreadJoinTimeout} and - * {@link #stopUnresponsiveDaemonThreads} for further tuning. + * In certain cases (in particular if maven is embedded), you might need to keep this enabled to make sure threads + * are properly cleaned up to ensure they don't interfere with subsequent activity. In that case, see + * {@link #daemonThreadJoinTimeout} and {@link #stopUnresponsiveDaemonThreads} for further tuning. *

- * @parameter expression="${exec.cleanupDaemonThreads} default-value="true" + * * @since 1.1-beta-1 */ - private boolean cleanupDaemonThreads; + @Parameter( property = "exec.cleanupDaemonThreads", defaultValue = "true" ) + private boolean cleanupDaemonThreads; - /** + /** * This defines the number of milliseconds to wait for daemon threads to quit following their interruption.
- * This is only taken into account if {@link #cleanupDaemonThreads} is true. - * A value <=0 means to not timeout (i.e. wait indefinitely for threads to finish). Following a timeout, a - * warning will be logged. - *

Note: properly coded threads should terminate upon interruption but some threads may prove - * problematic: as the VM does interrupt daemon threads, some code may not have been written to handle - * interruption properly. For example java.util.Timer is known to not handle interruptions in JDK <= 1.6. - * So it is not possible for us to infinitely wait by default otherwise maven could hang. A sensible default - * value has been chosen, but this default value may change in the future based on user feedback.

- * @parameter expression="${exec.daemonThreadJoinTimeout}" default-value="15000" + * This is only taken into account if {@link #cleanupDaemonThreads} is true. A value <=0 means to + * not timeout (i.e. wait indefinitely for threads to finish). Following a timeout, a warning will be logged. + *

+ * Note: properly coded threads should terminate upon interruption but some threads may prove problematic: as + * the VM does interrupt daemon threads, some code may not have been written to handle interruption properly. For + * example java.util.Timer is known to not handle interruptions in JDK <= 1.6. So it is not possible for us to + * infinitely wait by default otherwise maven could hang. A sensible default value has been chosen, but this default + * value may change in the future based on user feedback. + *

+ * * @since 1.1-beta-1 */ + @Parameter( property = "exec.daemonThreadJoinTimeout", defaultValue = "15000" ) private long daemonThreadJoinTimeout; /** - * Wether to call {@link Thread#stop()} following a timing out of waiting for an interrupted thread to finish. - * This is only taken into account if {@link #cleanupDaemonThreads} is true - * and the {@link #daemonThreadJoinTimeout} threshold has been reached for an uncooperative thread. - * If this is false, or if {@link Thread#stop()} fails to get the thread to stop, then - * a warning is logged and Maven will continue on while the affected threads (and related objects in memory) - * linger on. Consider setting this to true if you are invoking problematic code that you can't fix. - * An example is {@link java.util.Timer} which doesn't respond to interruption. To have Timer - * fixed, vote for this bug. - * @parameter expression="${exec.stopUnresponsiveDaemonThreads} default-value="false" + * Wether to call {@link Thread#stop()} following a timing out of waiting for an interrupted thread to finish. This + * is only taken into account if {@link #cleanupDaemonThreads} is true and the + * {@link #daemonThreadJoinTimeout} threshold has been reached for an uncooperative thread. If this is + * false, or if {@link Thread#stop()} fails to get the thread to stop, then a warning is logged and + * Maven will continue on while the affected threads (and related objects in memory) linger on. Consider setting + * this to true if you are invoking problematic code that you can't fix. An example is + * {@link java.util.Timer} which doesn't respond to interruption. To have Timer fixed, vote for + * this bug. + * * @since 1.1-beta-1 */ + @Parameter( property = "exec.stopUnresponsiveDaemonThreads", defaultValue = "false" ) private boolean stopUnresponsiveDaemonThreads; /** * Deprecated this is not needed anymore. - * - * @parameter expression="${exec.killAfter}" default-value="-1" + * * @deprecated since 1.1-alpha-1 * @since 1.0 */ + @Parameter( property = "exec.killAfter", defaultValue = "-1" ) + @Deprecated private long killAfter; - + private Properties originalSystemProperties; /** + * Additional elements to be appended to the classpath. + * + * @since 1.3 + */ + @Parameter + private List additionalClasspathElements; + + /** * Execute goal. + * * @throws MojoExecutionException execution of the main class or one of the threads it generated failed. * @throws MojoFailureException something bad happened... */ public void execute() throws MojoExecutionException, MojoFailureException { + if ( isSkip() ) + { + getLog().info( "skipping execute as per configuration" ); + return; + } if ( killAfter != -1 ) { getLog().warn( "Warning: killAfter is now deprecated. Do you need it ? Please comment on MEXEC-6." ); @@ -263,35 +256,44 @@ msg.append( arguments[i] ); } msg.append( ")" ); - getLog().debug( msg ); + getLog().debug( msg ); } - IsolatedThreadGroup threadGroup = new IsolatedThreadGroup( mainClass /*name*/ ); + IsolatedThreadGroup threadGroup = new IsolatedThreadGroup( mainClass /* name */ ); Thread bootstrapThread = new Thread( threadGroup, new Runnable() { public void run() { try { - Method main = Thread.currentThread().getContextClassLoader().loadClass( mainClass ) - .getMethod( "main", new Class[]{ String[].class } ); - if ( ! main.isAccessible() ) + Method main = + Thread.currentThread().getContextClassLoader().loadClass( mainClass ).getMethod( "main", + new Class[] { + String[].class } ); + if ( !main.isAccessible() ) { getLog().debug( "Setting accessibility to true in order to invoke main()." ); main.setAccessible( true ); } - main.invoke( main, new Object[]{arguments} ); + if ( !Modifier.isStatic( main.getModifiers() ) ) + { + throw new MojoExecutionException( "Can't call main(String[])-method because it is not static." ); + } + main.invoke( null, new Object[] { arguments } ); } catch ( NoSuchMethodException e ) - { // just pass it on - Thread.currentThread().getThreadGroup().uncaughtException( Thread.currentThread(), - new Exception( - "The specified mainClass doesn't contain a main method with appropriate signature.", e - ) - ); + { // just pass it on + Thread.currentThread().getThreadGroup().uncaughtException( Thread.currentThread(), + new Exception( "The specified mainClass doesn't contain a main method with appropriate signature.", + e ) ); + } + catch ( InvocationTargetException e ) + { // use the cause if available to improve the plugin execution output + Throwable exceptionToReport = e.getCause() != null ? e.getCause() : e; + Thread.currentThread().getThreadGroup().uncaughtException( Thread.currentThread(), exceptionToReport ); } catch ( Exception e ) - { // just pass it on + { // just pass it on Thread.currentThread().getThreadGroup().uncaughtException( Thread.currentThread(), e ); } } @@ -305,16 +307,15 @@ // but it's too late since the termination condition (only daemon threads) has been triggered. if ( keepAlive ) { - getLog().warn( - "Warning: keepAlive is now deprecated and obsolete. Do you need it? Please comment on MEXEC-6." ); + getLog().warn( "Warning: keepAlive is now deprecated and obsolete. Do you need it? Please comment on MEXEC-6." ); waitFor( 0 ); } if ( cleanupDaemonThreads ) { - + terminateThreads( threadGroup ); - + try { threadGroup.destroy(); @@ -324,7 +325,6 @@ getLog().warn( "Couldn't destroy threadgroup " + threadGroup, e ); } } - if ( originalSystemProperties != null ) { @@ -335,9 +335,8 @@ { if ( threadGroup.uncaughtException != null ) { - throw new MojoExecutionException( "An exception occured while executing the Java class. " - + threadGroup.uncaughtException.getMessage(), - threadGroup.uncaughtException ); + throw new MojoExecutionException( "An exception occured while executing the Java class. " + + threadGroup.uncaughtException.getMessage(), threadGroup.uncaughtException ); } } @@ -347,9 +346,10 @@ /** * a ThreadGroup to isolate execution and collect exceptions. */ - class IsolatedThreadGroup extends ThreadGroup + class IsolatedThreadGroup + extends ThreadGroup { - Throwable uncaughtException; // synchronize access to this + private Throwable uncaughtException; // synchronize access to this public IsolatedThreadGroup( String name ) { @@ -360,24 +360,16 @@ { if ( throwable instanceof ThreadDeath ) { - return; //harmless + return; // harmless } - boolean doLog = false; synchronized ( this ) { if ( uncaughtException == null ) // only remember the first one { uncaughtException = throwable; // will be reported eventually } - else - { - doLog = true; - } - } - if ( doLog ) - { - getLog().warn( "an additional exception was thrown", throwable ); } + getLog().warn( throwable ); } } @@ -387,18 +379,18 @@ do { foundNonDaemon = false; - Collection threads = getActiveThreads( threadGroup ); - for ( Iterator iter = threads.iterator(); iter.hasNext(); ) + Collection threads = getActiveThreads( threadGroup ); + for ( Thread thread : threads ) { - Thread thread = (Thread) iter.next(); if ( thread.isDaemon() ) { continue; } - foundNonDaemon = true; //try again; maybe more threads were created while we were busy + foundNonDaemon = true; // try again; maybe more threads were created while we were busy joinThread( thread, 0 ); } - } while ( foundNonDaemon ); + } + while ( foundNonDaemon ); } private void joinThread( Thread thread, long timeoutMsecs ) @@ -410,10 +402,10 @@ } catch ( InterruptedException e ) { - Thread.currentThread().interrupt(); // good practice if don't throw - getLog().warn( "interrupted while joining against thread " + thread, e ); // not expected! + Thread.currentThread().interrupt(); // good practice if don't throw + getLog().warn( "interrupted while joining against thread " + thread, e ); // not expected! } - if ( thread.isAlive() ) //generally abnormal + if ( thread.isAlive() ) // generally abnormal { getLog().warn( "thread " + thread + " was interrupted but is still alive after waiting at least " + timeoutMsecs + "msecs" ); @@ -423,38 +415,35 @@ private void terminateThreads( ThreadGroup threadGroup ) { long startTime = System.currentTimeMillis(); - Set uncooperativeThreads = new HashSet(); // these were not responsive to interruption - for ( Collection threads = getActiveThreads( threadGroup ); !threads.isEmpty(); - threads = getActiveThreads( threadGroup ), threads.removeAll( uncooperativeThreads ) ) + Set uncooperativeThreads = new HashSet(); // these were not responsive to interruption + for ( Collection threads = getActiveThreads( threadGroup ); !threads.isEmpty(); threads = + getActiveThreads( threadGroup ), threads.removeAll( uncooperativeThreads ) ) { // Interrupt all threads we know about as of this instant (harmless if spuriously went dead (! isAlive()) - // or if something else interrupted it ( isInterrupted() ). - for ( Iterator iter = threads.iterator(); iter.hasNext(); ) + // or if something else interrupted it ( isInterrupted() ). + for ( Thread thread : threads ) { - Thread thread = (Thread) iter.next(); getLog().debug( "interrupting thread " + thread ); thread.interrupt(); } // Now join with a timeout and call stop() (assuming flags are set right) - for ( Iterator iter = threads.iterator(); iter.hasNext(); ) + for ( Thread thread : threads ) { - Thread thread = (Thread) iter.next(); - if ( ! thread.isAlive() ) + if ( !thread.isAlive() ) { - continue; //and, presumably it won't show up in getActiveThreads() next iteration + continue; // and, presumably it won't show up in getActiveThreads() next iteration } if ( daemonThreadJoinTimeout <= 0 ) { - joinThread( thread, 0 ); //waits until not alive; no timeout + joinThread( thread, 0 ); // waits until not alive; no timeout continue; } - long timeout = daemonThreadJoinTimeout - - ( System.currentTimeMillis() - startTime ); + long timeout = daemonThreadJoinTimeout - ( System.currentTimeMillis() - startTime ); if ( timeout > 0 ) { joinThread( thread, timeout ); } - if ( ! thread.isAlive() ) + if ( !thread.isAlive() ) { continue; } @@ -470,7 +459,7 @@ } } } - if ( ! uncooperativeThreads.isEmpty() ) + if ( !uncooperativeThreads.isEmpty() ) { getLog().warn( "NOTE: " + uncooperativeThreads.size() + " thread(s) did not finish despite being asked to " + " via interruption. This is not a problem with exec:java, it is a problem with the running code." @@ -484,22 +473,22 @@ // TODO this may be nothing; continue on anyway; perhaps don't even log in future Thread[] threadsArray = new Thread[1]; threadGroup.enumerate( threadsArray ); - getLog().debug( "strange; " + activeCount - + " thread(s) still active in the group " + threadGroup + " such as " + threadsArray[0] ); + getLog().debug( "strange; " + activeCount + " thread(s) still active in the group " + threadGroup + + " such as " + threadsArray[0] ); } } } - private Collection getActiveThreads( ThreadGroup threadGroup ) + private Collection getActiveThreads( ThreadGroup threadGroup ) { - Thread[] threads = new Thread[ threadGroup.activeCount() ]; + Thread[] threads = new Thread[threadGroup.activeCount()]; int numThreads = threadGroup.enumerate( threads ); - Collection result = new ArrayList( numThreads ); + Collection result = new ArrayList( numThreads ); for ( int i = 0; i < threads.length && threads[i] != null; i++ ) { result.add( threads[i] ); } - return result; //note: result should be modifiable + return result; // note: result should be modifiable } /** @@ -510,9 +499,8 @@ if ( systemProperties != null ) { originalSystemProperties = System.getProperties(); - for ( int i = 0; i < systemProperties.length; i++ ) + for ( Property systemProperty : systemProperties ) { - Property systemProperty = systemProperties[i]; String value = systemProperty.getValue(); System.setProperty( systemProperty.getKey(), value == null ? "" : value ); } @@ -521,27 +509,53 @@ /** * Set up a classloader for the execution of the main class. - * + * * @return the classloader * @throws MojoExecutionException if a problem happens */ private ClassLoader getClassLoader() throws MojoExecutionException { - List classpathURLs = new ArrayList(); + List classpathURLs = new ArrayList(); this.addRelevantPluginDependenciesToClasspath( classpathURLs ); this.addRelevantProjectDependenciesToClasspath( classpathURLs ); - return new URLClassLoader( ( URL[] ) classpathURLs.toArray( new URL[ classpathURLs.size() ] ) ); + this.addAdditionalClasspathElements( classpathURLs ); + return new URLClassLoader( classpathURLs.toArray( new URL[classpathURLs.size()] ) ); + } + + private void addAdditionalClasspathElements( List path ) + { + if ( additionalClasspathElements != null ) + { + for ( String classPathElement : additionalClasspathElements ) + { + try + { + File file = new File( classPathElement ); + if ( !file.isAbsolute() ) + { + file = new File( project.getBasedir(), classPathElement ); + } + URL url = file.toURI().toURL(); + getLog().debug( "Adding additional classpath element: " + url + " to classpath" ); + path.add( url ); + } + catch ( MalformedURLException e ) + { + getLog().warn( "Skipping additional classpath element: " + classPathElement, e ); + } + } + } } /** - * Add any relevant project dependencies to the classpath. - * Indirectly takes includePluginDependencies and ExecutableDependency into consideration. - * + * Add any relevant project dependencies to the classpath. Indirectly takes includePluginDependencies and + * ExecutableDependency into consideration. + * * @param path classpath of {@link java.net.URL} objects * @throws MojoExecutionException if a problem happens */ - private void addRelevantPluginDependenciesToClasspath( List path ) + private void addRelevantPluginDependenciesToClasspath( List path ) throws MojoExecutionException { if ( hasCommandlineArgs() ) @@ -551,13 +565,11 @@ try { - Iterator iter = this.determineRelevantPluginDependencies().iterator(); - while ( iter.hasNext() ) + for ( Artifact classPathElement : this.determineRelevantPluginDependencies() ) { - Artifact classPathElement = (Artifact) iter.next(); - getLog().debug( - "Adding plugin dependency artifact: " + classPathElement.getArtifactId() + " to classpath" ); - path.add( classPathElement.getFile().toURL() ); + getLog().debug( "Adding plugin dependency artifact: " + classPathElement.getArtifactId() + + " to classpath" ); + path.add( classPathElement.getFile().toURI().toURL() ); } } catch ( MalformedURLException e ) @@ -568,13 +580,12 @@ } /** - * Add any relevant project dependencies to the classpath. - * Takes includeProjectDependencies into consideration. - * + * Add any relevant project dependencies to the classpath. Takes includeProjectDependencies into consideration. + * * @param path classpath of {@link java.net.URL} objects * @throws MojoExecutionException if a problem happens */ - private void addRelevantProjectDependenciesToClasspath( List path ) + private void addRelevantProjectDependenciesToClasspath( List path ) throws MojoExecutionException { if ( this.includeProjectDependencies ) @@ -583,25 +594,23 @@ { getLog().debug( "Project Dependencies will be included." ); - List artifacts = new ArrayList(); - List theClasspathFiles = new ArrayList(); - + List artifacts = new ArrayList(); + List theClasspathFiles = new ArrayList(); + collectProjectArtifactsAndClasspath( artifacts, theClasspathFiles ); - for ( Iterator it = theClasspathFiles.iterator(); it.hasNext(); ) + for ( File classpathFile : theClasspathFiles ) { - URL url = ( (File) it.next() ).toURL(); - getLog().debug( "Adding to classpath : " + url ); - path.add( url ); + URL url = classpathFile.toURI().toURL(); + getLog().debug( "Adding to classpath : " + url ); + path.add( url ); } - Iterator iter = artifacts.iterator(); - while ( iter.hasNext() ) + for ( Artifact classPathElement : artifacts ) { - Artifact classPathElement = (Artifact) iter.next(); - getLog().debug( - "Adding project dependency artifact: " + classPathElement.getArtifactId() + " to classpath" ); - path.add( classPathElement.getFile().toURL() ); + getLog().debug( "Adding project dependency artifact: " + classPathElement.getArtifactId() + + " to classpath" ); + path.add( classPathElement.getFile().toURI().toURL() ); } } @@ -618,23 +627,22 @@ } /** - * Determine all plugin dependencies relevant to the executable. - * Takes includePlugins, and the executableDependency into consideration. - * - * @return a set of Artifact objects. - * (Empty set is returned if there are no relevant plugin dependencies.) + * Determine all plugin dependencies relevant to the executable. Takes includePlugins, and the executableDependency + * into consideration. + * + * @return a set of Artifact objects. (Empty set is returned if there are no relevant plugin dependencies.) * @throws MojoExecutionException if a problem happens resolving the plufin dependencies */ - private Set determineRelevantPluginDependencies() + private Set determineRelevantPluginDependencies() throws MojoExecutionException { - Set relevantDependencies; + Set relevantDependencies; if ( this.includePluginDependencies ) { if ( this.executableDependency == null ) { getLog().debug( "All Plugin Dependencies will be included." ); - relevantDependencies = new HashSet( this.pluginDependencies ); + relevantDependencies = new HashSet( this.pluginDependencies ); } else { @@ -646,7 +654,7 @@ } else { - relevantDependencies = Collections.EMPTY_SET; + relevantDependencies = Collections.emptySet(); getLog().debug( "Plugin Dependencies will be excluded." ); } return relevantDependencies; @@ -654,7 +662,7 @@ /** * Get the artifact which refers to the POM of the executable artifact. - * + * * @param executableArtifact this artifact refers to the actual assembly. * @return an artifact which refers to the POM of the executable artifact. */ @@ -666,80 +674,45 @@ } /** - * Examine the plugin dependencies to find the executable artifact. - * - * @return an artifact which refers to the actual executable tool (not a POM) - * @throws MojoExecutionException if no executable artifact was found - */ - private Artifact findExecutableArtifact() - throws MojoExecutionException - { - //ILimitedArtifactIdentifier execToolAssembly = this.getExecutableToolAssembly(); - - Artifact executableTool = null; - for ( Iterator iter = this.pluginDependencies.iterator(); iter.hasNext(); ) - { - Artifact pluginDep = (Artifact) iter.next(); - if ( this.executableDependency.matches( pluginDep ) ) - { - executableTool = pluginDep; - break; - } - } - - if ( executableTool == null ) - { - throw new MojoExecutionException( - "No dependency of the plugin matches the specified executableDependency." - + " Specified executableToolAssembly is: " + executableDependency.toString() ); - } - - return executableTool; - } - - /** * Resolve the executable dependencies for the specified project + * * @param executablePomArtifact the project's POM * @return a set of Artifacts * @throws MojoExecutionException if a failure happens */ - private Set resolveExecutableDependencies( Artifact executablePomArtifact ) + private Set resolveExecutableDependencies( Artifact executablePomArtifact ) throws MojoExecutionException { - Set executableDependencies; + Set executableDependencies; try { - MavenProject executableProject = this.projectBuilder.buildFromRepository( executablePomArtifact, - this.remoteRepositories, - this.localRepository ); + MavenProject executableProject = + this.projectBuilder.buildFromRepository( executablePomArtifact, this.remoteRepositories, + this.localRepository ); - //get all of the dependencies for the executable project - List dependencies = executableProject.getDependencies(); + // get all of the dependencies for the executable project + List dependencies = executableProject.getDependencies(); - //make Artifacts of all the dependencies - Set dependencyArtifacts = + // make Artifacts of all the dependencies + Set dependencyArtifacts = MavenMetadataSource.createArtifacts( this.artifactFactory, dependencies, null, null, null ); - //not forgetting the Artifact of the project itself + // not forgetting the Artifact of the project itself dependencyArtifacts.add( executableProject.getArtifact() ); - //resolve all dependencies transitively to obtain a comprehensive list of assemblies - ArtifactResolutionResult result = artifactResolver.resolveTransitively( dependencyArtifacts, - executablePomArtifact, - Collections.EMPTY_MAP, - this.localRepository, - this.remoteRepositories, - metadataSource, null, - Collections.EMPTY_LIST ); + // resolve all dependencies transitively to obtain a comprehensive list of assemblies + ArtifactResolutionResult result = + artifactResolver.resolveTransitively( dependencyArtifacts, executablePomArtifact, + Collections.emptyMap(), this.localRepository, + this.remoteRepositories, metadataSource, null, + Collections.emptyList() ); executableDependencies = result.getArtifacts(); - } catch ( Exception ex ) { - throw new MojoExecutionException( - "Encountered problems resolving dependencies of the executable " + "in preparation for its execution.", - ex ); + throw new MojoExecutionException( "Encountered problems resolving dependencies of the executable " + + "in preparation for its execution.", ex ); } return executableDependencies; @@ -747,9 +720,8 @@ /** * Stop program execution for nn millis. - * - * @param millis the number of millis-seconds to wait for, - * 0 stops program forever. + * + * @param millis the number of millis-seconds to wait for, 0 stops program forever. */ private void waitFor( long millis ) { diff -Nru exec-maven-plugin-1.1.1+dfsg/src/main/java/org/codehaus/mojo/exec/ExecMojo.java exec-maven-plugin-1.6.0/src/main/java/org/codehaus/mojo/exec/ExecMojo.java --- exec-maven-plugin-1.1.1+dfsg/src/main/java/org/codehaus/mojo/exec/ExecMojo.java 2009-11-26 14:32:11.000000000 +0000 +++ exec-maven-plugin-1.6.0/src/main/java/org/codehaus/mojo/exec/ExecMojo.java 2017-03-02 20:58:24.000000000 +0000 @@ -1,154 +1,244 @@ package org.codehaus.mojo.exec; /* - * Copyright 2005-2006 The Codehaus. + * 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 * - * 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 * - * 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. + * 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. */ +import java.io.BufferedOutputStream; +import java.io.File; +import java.io.FileOutputStream; +import java.io.FileWriter; +import java.io.IOException; +import java.io.OutputStream; +import java.io.PrintWriter; +import java.net.URL; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collection; +import java.util.Collections; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Properties; +import java.util.Set; +import java.util.TreeSet; +import java.util.jar.JarEntry; +import java.util.jar.JarOutputStream; +import java.util.jar.Manifest; + +import org.apache.commons.exec.CommandLine; +import org.apache.commons.exec.DefaultExecutor; +import org.apache.commons.exec.ExecuteException; +import org.apache.commons.exec.ExecuteResultHandler; +import org.apache.commons.exec.Executor; +import org.apache.commons.exec.OS; +import org.apache.commons.exec.ProcessDestroyer; +import org.apache.commons.exec.PumpStreamHandler; +import org.apache.commons.exec.ShutdownHookProcessDestroyer; import org.apache.maven.artifact.Artifact; import org.apache.maven.artifact.resolver.filter.AndArtifactFilter; import org.apache.maven.artifact.resolver.filter.IncludesArtifactFilter; import org.apache.maven.execution.MavenSession; - -import org.apache.maven.plugin.logging.Log; import org.apache.maven.plugin.MojoExecutionException; +import org.apache.maven.plugins.annotations.Mojo; +import org.apache.maven.plugins.annotations.Parameter; +import org.apache.maven.plugins.annotations.ResolutionScope; import org.apache.maven.project.MavenProject; import org.apache.maven.toolchain.Toolchain; import org.apache.maven.toolchain.ToolchainManager; import org.codehaus.plexus.component.repository.exception.ComponentLookupException; +import org.codehaus.plexus.util.IOUtil; +import org.codehaus.plexus.util.StringUtils; import org.codehaus.plexus.util.cli.CommandLineException; import org.codehaus.plexus.util.cli.CommandLineUtils; import org.codehaus.plexus.util.cli.Commandline; +import org.codehaus.plexus.util.cli.DefaultConsumer; import org.codehaus.plexus.util.cli.StreamConsumer; -import java.io.File; -import java.io.FileOutputStream; -import java.io.PrintStream; -import java.util.ArrayList; -import java.util.Collection; -import java.util.Iterator; -import java.util.List; -import java.util.Map; -import java.util.HashMap; -import java.util.StringTokenizer; - /** * A Plugin for executing external programs. * - * @author Jerome Lacoste - * @version $Id: ExecMojo.java 8882 2009-01-22 20:47:34Z lacostej $ - * @goal exec - * @requiresDependencyResolution test + * @author Jerome Lacoste (jerome@coffeebreaks.org) + * @version $Id$ * @since 1.0 */ +@Mojo( name = "exec", threadSafe = true, requiresDependencyResolution = ResolutionScope.TEST ) public class ExecMojo extends AbstractExecMojo { /** - * Skip the execution. + *

+ * The executable. Can be a full path or the name of the executable. In the latter case, the executable must be in + * the PATH for the execution to work. Omit when using executableDependency. + *

+ *

+ * The plugin will search for the executable in the following order: + *

    + *
  1. relative to the root of the project
  2. + *
  3. as toolchain executable
  4. + *
  5. relative to the working directory (Windows only)
  6. + *
  7. relative to the directories specified in the system property PATH (Windows Only)
  8. + *
+ * Otherwise use the executable as is. + *

* - * @parameter expression="${skip}" default-value="false" - * @since 1.0.1 + * @since 1.0 */ - private boolean skip; + @Parameter( property = "exec.executable" ) + private String executable; /** - * The executable. Can be a full path or a the name executable. In the latter case, the executable must be - * in the PATH for the execution to work. - * - * @parameter expression="${exec.executable}" - * @required - * @since 1.0 + *

+ * The toolchain. If omitted, "jdk" is assumed. + *

*/ - private String executable; + @Parameter( property = "exec.toolchain", defaultValue = "jdk" ) + private String toolchain; /** * The current working directory. Optional. If not specified, basedir will be used. - * - * @parameter expression="${exec.workingdir} + * * @since 1.0 */ + @Parameter( property = "exec.workingdir" ) private File workingDirectory; /** - * Program standard and error output will be redirected to the file specified by this optional field. - * If not specified the standard maven logging is used. + * Program standard and error output will be redirected to the file specified by this optional field. If not + * specified the standard Maven logging is used.
+ * Note: Be aware that System.out and System.err use buffering, so don't + * rely on the order! * - * @parameter expression="${exec.outputFile}" * @since 1.1-beta-2 + * @see java.lang.System#err + * @see java.lang.System#in */ + @Parameter( property = "exec.outputFile" ) private File outputFile; /** - * Can be of type <argument> or <classpath> - * Can be overriden using "exec.args" env. variable + *

+ * A list of arguments passed to the {@code executable}, which should be of type <argument> or + * <classpath>. Can be overridden by using the exec.args environment variable. + *

* - * @parameter * @since 1.0 */ - private List arguments; + @Parameter + private List arguments; // TODO: Change ? into something more meaningful /** - * @parameter expression="${basedir}" - * @required - * @readonly * @since 1.0 */ + @Parameter( readonly = true, required = true, defaultValue = "${basedir}" ) private File basedir; /** * Environment variables to pass to the executed program. - * @parameter + * * @since 1.1-beta-2 */ - private Map environmentVariables = new HashMap(); + @Parameter + private Map environmentVariables = new HashMap(); /** - * The current build session instance. This is used for - * toolchain manager API calls. + * Environment script to be merged with environmentVariables This script is platform specifics, on Unix its + * must be Bourne shell format. Use this feature if you have a need to create environment variable dynamically such + * as invoking Visual Studio environment script file * - * @parameter expression="${session}" - * @required - * @readonly + * @since 1.4.0 + */ + @Parameter + private File environmentScript = null; + + /** + * The current build session instance. This is used for toolchain manager API calls. */ + @Parameter( defaultValue = "${session}", readonly = true ) private MavenSession session; - + /** - * Exit codes to be resolved as successful execution for non-compliant - * applications (applications not returning 0 for success). - * - * @parameter + * Exit codes to be resolved as successful execution for non-compliant applications (applications not returning 0 + * for success). + * * @since 1.1.1 */ - private List successCodes; - + @Parameter + private int[] successCodes; + /** - * if exec.args expression is used when invokign the exec:exec goal, - * any occurence of %classpath argument is replaced by the actual project dependency classpath. - */ - public static final String CLASSPATH_TOKEN = "%classpath"; + * If set to true the classpath and the main class will be written to a MANIFEST.MF file and wrapped into a jar. + * Instead of '-classpath/-cp CLASSPATH mainClass' the exec plugin executes '-jar maven-exec.jar'. + * + * @since 1.1.2 + */ + @Parameter( property = "exec.longClasspath", defaultValue = "false" ) + private boolean longClasspath; + + /** + * If set to true the modulepath and the main class will be written as an @arg file + * Instead of '--module-path/-p MODULEPATH ' the exec plugin executes '@modulepath'. + * + * @since 1.1.2 + */ + @Parameter( property = "exec.longModulepath", defaultValue = "true" ) + private boolean longModulepath; + + /** + * If set to true the child process executes asynchronously and build execution continues in parallel. + */ + @Parameter( property = "exec.async", defaultValue = "false" ) + private boolean async; + + /** + * If set to true, the asynchronous child process is destroyed upon JVM shutdown. If set to false, asynchronous + * child process continues execution after JVM shutdown. Applies only to asynchronous processes; ignored for + * synchronous processes. + */ + @Parameter( property = "exec.asyncDestroyOnShutdown", defaultValue = "true" ) + private boolean asyncDestroyOnShutdown = true; + + public static final String CLASSPATH_TOKEN = "%classpath"; + + public static final String MODULEPATH_TOKEN = "%modulepath"; /** * priority in the execute method will be to use System properties arguments over the pom specification. + * * @throws MojoExecutionException if a failure happens */ public void execute() throws MojoExecutionException { - if ( skip ) + if ( executable == null ) { - getLog().info( "skipping execute as per configuraion" ); + if (executableDependency == null) + { + throw new MojoExecutionException( "The parameter 'executable' is missing or invalid" ); + } + + executable = findExecutableArtifact().getFile().getAbsolutePath(); + getLog().debug( "using executable dependency " + executable); + } + + if ( isSkip() ) + { + getLog().info( "skipping execute as per configuration" ); return; } @@ -157,77 +247,154 @@ throw new IllegalStateException( "basedir is null. Should not be possible." ); } - String argsProp = getSystemProperty( "exec.args" ); + try + { + + handleWorkingDirectory(); - List commandArguments = new ArrayList(); + String argsProp = getSystemProperty( "exec.args" ); - if ( hasCommandlineArgs() ) - { - String[] args = parseCommandlineArgs(); - for ( int i = 0; i < args.length; i++ ) + List commandArguments = new ArrayList(); + + if ( hasCommandlineArgs() ) { - if ( CLASSPATH_TOKEN.equals( args[i] ) ) - { - commandArguments.add( computeClasspath( null ) ); - } - else + handleCommandLineArgs( commandArguments ); + } + else if ( !StringUtils.isEmpty( argsProp ) ) + { + handleSystemPropertyArguments( argsProp, commandArguments ); + } + else + { + if ( arguments != null ) { - commandArguments.add( args[i] ); + handleArguments( commandArguments ); } } - } - else if ( !isEmpty( argsProp ) ) - { - getLog().debug( "got arguments from system properties: " + argsProp ); - StringTokenizer strtok = new StringTokenizer( argsProp, " " ); - while ( strtok.hasMoreTokens() ) - { - commandArguments.add( strtok.nextToken() ); - } - } - else - { - if ( arguments != null ) + Map enviro = handleSystemEnvVariables(); + + CommandLine commandLine = getExecutablePath( enviro, workingDirectory ); + + String[] args = commandArguments.toArray( new String[commandArguments.size()] ); + + commandLine.addArguments( args, false ); + + Executor exec = new DefaultExecutor(); + exec.setWorkingDirectory( workingDirectory ); + fillSuccessCodes( exec ); + + getLog().debug( "Executing command line: " + commandLine ); + + try { - for ( int i = 0; i < arguments.size(); i++ ) + int resultCode; + if ( outputFile != null ) { - Object argument = arguments.get( i ); - String arg; - if ( argument == null ) + if ( !outputFile.getParentFile().exists() && !outputFile.getParentFile().mkdirs() ) { - throw new MojoExecutionException( - "Misconfigured argument, value is null. Set the argument to an empty value" - + " if this is the required behaviour." ); + getLog().warn( "Could not create non existing parent directories for log file: " + outputFile ); } - else if ( argument instanceof Classpath ) + + FileOutputStream outputStream = null; + try { - Classpath specifiedClasspath = (Classpath) argument; + outputStream = new FileOutputStream( outputFile ); - arg = computeClasspath( specifiedClasspath ); + resultCode = executeCommandLine( exec, commandLine, enviro, outputStream ); } - else + finally { - arg = argument.toString(); + IOUtil.close( outputStream ); } - commandArguments.add( arg ); } + else + { + resultCode = executeCommandLine( exec, commandLine, enviro, System.out, System.err ); + } + + if ( isResultCodeAFailure( resultCode ) ) + { + String message = "Result of " + commandLine.toString() + " execution is: '" + resultCode + "'."; + getLog().error( message ); + throw new MojoExecutionException( message ); + } + } + catch ( ExecuteException e ) + { + getLog().error( "Command execution failed.", e ); + throw new MojoExecutionException( "Command execution failed.", e ); + } + catch ( IOException e ) + { + getLog().error( "Command execution failed.", e ); + throw new MojoExecutionException( "Command execution failed.", e ); } + + registerSourceRoots(); + } + catch ( IOException e ) + { + throw new MojoExecutionException( "I/O Error", e ); } + } - Commandline commandLine = new Commandline(); + private Map handleSystemEnvVariables() + throws MojoExecutionException + { - commandLine.setExecutable( getExecutablePath() ); + Map enviro = new HashMap(); + try + { + Properties systemEnvVars = CommandLineUtils.getSystemEnvVars(); + for ( Map.Entry entry : systemEnvVars.entrySet() ) + { + enviro.put( (String) entry.getKey(), (String) entry.getValue() ); + } + } + catch ( IOException x ) + { + getLog().error( "Could not assign default system enviroment variables.", x ); + } - String [] args = new String[ commandArguments.size() ]; - for ( int i = 0; i < commandArguments.size(); i++ ) + if ( environmentVariables != null ) { - args[i] = (String) commandArguments.get( i ); - + enviro.putAll( environmentVariables ); } - commandLine.addArguments( args ); + if ( this.environmentScript != null ) + { + getLog().info( "Pick up external environment script: " + this.environmentScript ); + Map envVarsFromScript = this.createEnvs( this.environmentScript ); + if ( envVarsFromScript != null ) + { + enviro.putAll( envVarsFromScript ); + } + } + if ( this.getLog().isDebugEnabled() ) + { + Set keys = new TreeSet(); + keys.addAll( enviro.keySet() ); + for ( String key : keys ) + { + this.getLog().debug( "env: " + key + "=" + enviro.get( key ) ); + } + } + + return enviro; + } + + /** + * This is a convenient method to make the execute method a little bit more readable. It will define the + * workingDirectory to be the baseDir in case of workingDirectory is null. If the workingDirectory does not exist it + * will created. + * + * @throws MojoExecutionException + */ + private void handleWorkingDirectory() + throws MojoExecutionException + { if ( workingDirectory == null ) { workingDirectory = basedir; @@ -238,135 +405,196 @@ getLog().debug( "Making working directory '" + workingDirectory.getAbsolutePath() + "'." ); if ( !workingDirectory.mkdirs() ) { - throw new MojoExecutionException( - "Could not make working directory: '" + workingDirectory.getAbsolutePath() + "'" ); + throw new MojoExecutionException( "Could not make working directory: '" + + workingDirectory.getAbsolutePath() + "'" ); } } + } - commandLine.setWorkingDirectory( workingDirectory.getAbsolutePath() ); - - if ( environmentVariables != null ) + private void handleSystemPropertyArguments( String argsProp, List commandArguments ) + throws MojoExecutionException + { + getLog().debug( "got arguments from system properties: " + argsProp ); + + try { - Iterator iter = environmentVariables.keySet().iterator(); - while ( iter.hasNext() ) - { - String key = (String) iter.next(); - String value = (String) environmentVariables.get( key ); - commandLine.addEnvironment( key, value ); - } + String[] args = CommandLineUtils.translateCommandline( argsProp ); + commandArguments.addAll( Arrays.asList( args ) ); } + catch ( Exception e ) + { + throw new MojoExecutionException( "Couldn't parse systemproperty 'exec.args'" ); + } + } - final Log outputLog = getExecOutputLog(); - - StreamConsumer stdout = new StreamConsumer() + private void handleCommandLineArgs( List commandArguments ) + throws MojoExecutionException, IOException + { + String[] args = parseCommandlineArgs(); + for ( int i = 0; i < args.length; i++ ) { - public void consumeLine( String line ) + if ( isLongClassPathArgument( args[i] ) ) { - outputLog.info( line ); + // it is assumed that starting from -cp or -classpath the arguments + // are: -classpath/-cp %classpath mainClass + // the arguments are replaced with: -jar $TMP/maven-exec.jar + // NOTE: the jar will contain the classpath and the main class + commandArguments.add( "-jar" ); + File tmpFile = createJar( computePath( null ), args[i + 2] ); + commandArguments.add( tmpFile.getAbsolutePath() ); + i += 2; } - }; - - StreamConsumer stderr = new StreamConsumer() - { - public void consumeLine( String line ) + else if ( args[i].contains( CLASSPATH_TOKEN ) ) { - outputLog.info( line ); + commandArguments.add( args[i].replace( CLASSPATH_TOKEN, computeClasspathString( null ) ) ); } - }; + else + { + commandArguments.add( args[i] ); + } + } + } - try + private void handleArguments( List commandArguments ) + throws MojoExecutionException, IOException + { + for ( int i = 0; i < arguments.size(); i++ ) { - int resultCode = executeCommandLine( commandLine, stdout, stderr ); + Object argument = arguments.get( i ); + String arg; + if ( argument instanceof String && isLongClassPathArgument( (String) argument ) ) + { + // it is assumed that starting from -cp or -classpath the arguments + // are: -classpath/-cp %classpath mainClass + // the arguments are replaced with: -jar $TMP/maven-exec.jar + // NOTE: the jar will contain the classpath and the main class + commandArguments.add( "-jar" ); + File tmpFile = createJar( computePath( (Classpath) arguments.get( i + 1 ) ), + (String) arguments.get( i + 2 ) ); + commandArguments.add( tmpFile.getAbsolutePath() ); + i += 2; + } + if ( argument instanceof String && isLongModulePathArgument( (String) argument ) ) + { + String filePath = "target/modulepath"; + + commandArguments.add( '@' + filePath ); + + String modulePath = StringUtils.join( computePath( (Modulepath) arguments.get( ++i ) ).iterator(), File.pathSeparator ); + + createArgFile( filePath, Arrays.asList( "-p", modulePath ) ); + } + else if ( argument instanceof Classpath ) + { + Classpath specifiedClasspath = (Classpath) argument; - if ( isResultCodeAFailure( resultCode ) ) + arg = computeClasspathString( specifiedClasspath ); + commandArguments.add( arg ); + } + else if ( argument instanceof Modulepath ) + { + Modulepath specifiedModulepath = (Modulepath) argument; + + arg = computeClasspathString( specifiedModulepath ); + commandArguments.add( arg ); + } + else { - throw new MojoExecutionException( "Result of " + commandLine + " execution is: '" + resultCode + "'." ); + commandArguments.add( (String) argument ); } } - catch ( CommandLineException e ) + } + + private void fillSuccessCodes( Executor exec ) + { + if ( successCodes != null && successCodes.length > 0 ) { - throw new MojoExecutionException( "Command execution failed.", e ); + exec.setExitValues( successCodes ); } - - registerSourceRoots(); } - boolean isResultCodeAFailure(int result) + boolean isResultCodeAFailure( int result ) { - if (successCodes == null || successCodes.size() == 0) + if ( successCodes == null || successCodes.length == 0 ) + { return result != 0; - for (Iterator it = successCodes.iterator(); it.hasNext(); ) + } + for ( int successCode : successCodes ) { - int code = Integer.parseInt((String) it.next()); - if (code == result) + if ( successCode == result ) + { return false; + } } return true; } - private Log getExecOutputLog() + private boolean isLongClassPathArgument( String arg ) { - Log log = getLog(); - if ( outputFile != null ) - { - try - { - if ( !outputFile.getParentFile().exists() && !outputFile.getParentFile().mkdirs() ) - { - getLog().warn( "Could not create non existing parent directories for log file: " + outputFile ); - } - PrintStream stream = new PrintStream( new FileOutputStream( outputFile ) ); + return longClasspath && ( "-classpath".equals( arg ) || "-cp".equals( arg ) ); + } - log = new StreamLog( stream ); - } - catch ( Exception e ) - { - getLog().warn( "Could not open " + outputFile + ". Using default log", e ); - } - } - - return log; + private boolean isLongModulePathArgument( String arg ) + { + return longModulepath && ( "--module-path".equals( arg ) || "-p".equals( arg ) ); } /** - * Compute the classpath from the specified Classpath. The computed classpath is based on the classpathScope. - * The plugin cannot know from maven the phase it is executed in. So we have to depend on the user to tell us - * he wants the scope in which the plugin is expected to be executed. - * @param specifiedClasspath Non null when the user restricted the dependenceis, null otherwise - (the default classpath will be used) + * Compute the classpath from the specified Classpath. The computed classpath is based on the classpathScope. The + * plugin cannot know from maven the phase it is executed in. So we have to depend on the user to tell us he wants + * the scope in which the plugin is expected to be executed. + * + * @param specifiedClasspath Non null when the user restricted the dependencies, null otherwise (the + * default classpath will be used) * @return a platform specific String representation of the classpath - */ - private String computeClasspath( Classpath specifiedClasspath ) + */ + private String computeClasspathString( AbstractPath specifiedClasspath ) { - // TODO we should consider rewriting this bit into something like - // List collectProjectClasspathAsListOfURLs( optionalFilter ); - // reusable by both mojos - List artifacts = new ArrayList(); - List theClasspathFiles = new ArrayList(); - + List resultList = computePath( specifiedClasspath ); + StringBuffer theClasspath = new StringBuffer(); + + for ( String str : resultList ) + { + addToClasspath( theClasspath, str ); + } + + return theClasspath.toString(); + } + + /** + * Compute the classpath from the specified Classpath. The computed classpath is based on the classpathScope. The + * plugin cannot know from maven the phase it is executed in. So we have to depend on the user to tell us he wants + * the scope in which the plugin is expected to be executed. + * + * @param specifiedClasspath Non null when the user restricted the dependencies, null otherwise (the + * default classpath will be used) + * @return a list of class path elements + */ + private List computePath( AbstractPath specifiedClasspath ) + { + List artifacts = new ArrayList(); + List theClasspathFiles = new ArrayList(); + List resultList = new ArrayList(); + collectProjectArtifactsAndClasspath( artifacts, theClasspathFiles ); - if ( specifiedClasspath != null && specifiedClasspath.getDependencies() != null ) + if ( ( specifiedClasspath != null ) && ( specifiedClasspath.getDependencies() != null ) ) { artifacts = filterArtifacts( artifacts, specifiedClasspath.getDependencies() ); } - StringBuffer theClasspath = new StringBuffer(); - - for ( Iterator it = theClasspathFiles.iterator(); it.hasNext(); ) + for ( File f : theClasspathFiles ) { - File f = (File) it.next(); - addToClasspath( theClasspath, f.getAbsolutePath() ); + resultList.add( f.getAbsolutePath() ); } - for ( Iterator it = artifacts.iterator(); it.hasNext(); ) + for ( Artifact artifact : artifacts ) { - Artifact artifact = (Artifact) it.next(); getLog().debug( "dealing with " + artifact ); - addToClasspath( theClasspath, artifact.getFile().getAbsolutePath() ); + resultList.add( artifact.getFile().getAbsolutePath() ); } - return theClasspath.toString(); + return resultList; } private static void addToClasspath( StringBuffer theClasspath, String toAdd ) @@ -378,16 +606,15 @@ theClasspath.append( toAdd ); } - private List filterArtifacts( List artifacts, Collection dependencies ) + private List filterArtifacts( List artifacts, Collection dependencies ) { AndArtifactFilter filter = new AndArtifactFilter(); - filter.add( new IncludesArtifactFilter( new ArrayList( dependencies ) ) ); // gosh + filter.add( new IncludesArtifactFilter( new ArrayList( dependencies ) ) ); // gosh - List filteredArtifacts = new ArrayList(); - for ( Iterator it = artifacts.iterator(); it.hasNext(); ) + List filteredArtifacts = new ArrayList(); + for ( Artifact artifact : artifacts ) { - Artifact artifact = (Artifact) it.next(); if ( filter.include( artifact ) ) { getLog().debug( "filtering in " + artifact ); @@ -397,46 +624,200 @@ return filteredArtifacts; } - String getExecutablePath() - { + private ProcessDestroyer processDestroyer; + + CommandLine getExecutablePath( Map enviro, File dir ) + { File execFile = new File( executable ); - if ( execFile.exists() ) + String exec = null; + if ( execFile.isFile() ) { getLog().debug( "Toolchains are ignored, 'executable' parameter is set to " + executable ); - return execFile.getAbsolutePath(); - } - else + exec = execFile.getAbsolutePath(); + } + + if ( exec == null ) { Toolchain tc = getToolchain(); - + // if the file doesn't exist & toolchain is null, the exec is probably in the PATH... // we should probably also test for isFile and canExecute, but the second one is only // available in SDK 6. - if ( tc != null ) + if ( tc != null ) { - getLog().info( "Toolchain in exec-maven-plugin: " + tc ); - executable = tc.findTool( executable ); - } + getLog().info( "Toolchain in exec-maven-plugin: " + tc ); + exec = tc.findTool( executable ); + } + else + { + if ( OS.isFamilyWindows() ) + { + List paths = this.getExecutablePaths( enviro ); + paths.add( 0, dir.getAbsolutePath() ); + + exec = findExecutable( executable, paths ); + } + } + } + + if ( exec == null ) + { + exec = executable; } - return executable; + CommandLine toRet; + if ( OS.isFamilyWindows() && !hasNativeExtension( exec ) && hasExecutableExtension( exec ) ) + { + // run the windows batch script in isolation and exit at the end + final String comSpec = System.getenv( "ComSpec" ); + toRet = new CommandLine( comSpec == null ? "cmd" : comSpec ); + toRet.addArgument( "/c" ); + toRet.addArgument( exec ); + } + else + { + toRet = new CommandLine( exec ); + } + + return toRet; } - private static boolean isEmpty( String string ) + static String findExecutable( final String executable, final List paths ) { - return string == null || string.length() == 0; + File f = null; + search: for ( final String path : paths ) + { + f = new File( path, executable ); + if ( !OS.isFamilyWindows() && f.isFile() ) + break; + else + for ( final String extension : getExecutableExtensions() ) + { + f = new File( path, executable + extension ); + if ( f.isFile() ) + break search; + } + } + + if ( f == null || !f.exists() ) + return null; + + return f.getAbsolutePath(); } - // - // methods used for tests purposes - allow mocking and simulate automatic setters - // + private static boolean hasNativeExtension( final String exec ) + { + final String lowerCase = exec.toLowerCase(); + return lowerCase.endsWith( ".exe" ) || lowerCase.endsWith( ".com" ); + } + + private static boolean hasExecutableExtension( final String exec ) + { + final String lowerCase = exec.toLowerCase(); + for ( final String ext : getExecutableExtensions() ) + if ( lowerCase.endsWith( ext ) ) + return true; + + return false; + } + + private static List getExecutableExtensions() + { + final String pathExt = System.getenv( "PATHEXT" ); + return pathExt == null ? Arrays.asList( ".bat", ".cmd" ) + : Arrays.asList( StringUtils.split( pathExt.toLowerCase(), File.pathSeparator ) ); + } + + private List getExecutablePaths( Map enviro ) + { + List paths = new ArrayList(); + paths.add( "" ); + + String path = enviro.get( "PATH" ); + if ( path != null ) + { + paths.addAll( Arrays.asList( StringUtils.split( path, File.pathSeparator ) ) ); + } + + return paths; + } + + protected int executeCommandLine( Executor exec, CommandLine commandLine, Map enviro, + OutputStream out, OutputStream err ) + throws ExecuteException, IOException + { + // note: don't use BufferedOutputStream here since it delays the outputs MEXEC-138 + PumpStreamHandler psh = new PumpStreamHandler( out, err, System.in ); + return executeCommandLine( exec, commandLine, enviro, psh ); + } + + protected int executeCommandLine( Executor exec, CommandLine commandLine, Map enviro, + FileOutputStream outputFile ) + throws ExecuteException, IOException + { + BufferedOutputStream bos = new BufferedOutputStream( outputFile ); + PumpStreamHandler psh = new PumpStreamHandler( bos ); + return executeCommandLine( exec, commandLine, enviro, psh ); + } - protected int executeCommandLine( Commandline commandLine, StreamConsumer stream1, StreamConsumer stream2 ) - throws CommandLineException + protected int executeCommandLine( Executor exec, final CommandLine commandLine, Map enviro, + final PumpStreamHandler psh ) + throws ExecuteException, IOException { - return CommandLineUtils.executeCommandLine( commandLine, stream1, stream2 ); + exec.setStreamHandler( psh ); + + int result; + try + { + psh.start(); + if ( async ) + { + if ( asyncDestroyOnShutdown ) + { + exec.setProcessDestroyer( getProcessDestroyer() ); + } + + exec.execute( commandLine, enviro, new ExecuteResultHandler() + { + public void onProcessFailed( ExecuteException e ) + { + getLog().error( "Async process failed for: " + commandLine, e ); + } + + public void onProcessComplete( int exitValue ) + { + getLog().info( "Async process complete, exit value = " + exitValue + " for: " + commandLine ); + try + { + psh.stop(); + } + catch ( IOException e ) + { + getLog().error( "Error stopping async process stream handler for: " + commandLine, e ); + } + } + } ); + result = 0; + } + else + { + result = exec.execute( commandLine, enviro ); + } + } + finally + { + if ( !async ) + { + psh.stop(); + } + } + return result; } + // + // methods used for tests purposes - allow mocking and simulate automatic setters + // + void setExecutable( String executable ) { this.executable = executable; @@ -457,7 +838,7 @@ this.workingDirectory = workingDir; } - void setArguments( List arguments ) + void setArguments( List arguments ) { this.arguments = arguments; } @@ -477,12 +858,16 @@ return System.getProperty( key ); } - public void setSuccessCodes(List list) + public void setSuccessCodes( Integer... list ) { - this.successCodes = list; + this.successCodes = new int[list.length]; + for ( int index = 0; index < list.length; index++ ) + { + successCodes[index] = list[index]; + } } - public List getSuccessCodes() + public int[] getSuccessCodes() { return successCodes; } @@ -490,17 +875,17 @@ private Toolchain getToolchain() { Toolchain tc = null; - + try { if ( session != null ) // session is null in tests.. { ToolchainManager toolchainManager = (ToolchainManager) session.getContainer().lookup( ToolchainManager.ROLE ); - + if ( toolchainManager != null ) - { - tc = toolchainManager.getToolchainFromBuildContext( "jdk", session ); + { + tc = toolchainManager.getToolchainFromBuildContext( toolchain, session ); } } } @@ -511,4 +896,166 @@ return tc; } + /** + * Create a jar with just a manifest containing a Main-Class entry for SurefireBooter and a Class-Path entry for all + * classpath elements. Copied from surefire (ForkConfiguration#createJar()) + * + * @param classPath List<String> of all classpath elements. + * @return + * @throws IOException + */ + private File createJar( List classPath, String mainClass ) + throws IOException + { + File file = File.createTempFile( "maven-exec", ".jar" ); + file.deleteOnExit(); + FileOutputStream fos = new FileOutputStream( file ); + JarOutputStream jos = new JarOutputStream( fos ); + jos.setLevel( JarOutputStream.STORED ); + JarEntry je = new JarEntry( "META-INF/MANIFEST.MF" ); + jos.putNextEntry( je ); + + Manifest man = new Manifest(); + + // we can't use StringUtils.join here since we need to add a '/' to + // the end of directory entries - otherwise the jvm will ignore them. + StringBuilder cp = new StringBuilder(); + for ( String el : classPath ) + { + // NOTE: if File points to a directory, this entry MUST end in '/'. + cp.append( new URL( new File( el ).toURI().toASCIIString() ).toExternalForm() + " " ); + } + + man.getMainAttributes().putValue( "Manifest-Version", "1.0" ); + man.getMainAttributes().putValue( "Class-Path", cp.toString().trim() ); + man.getMainAttributes().putValue( "Main-Class", mainClass ); + + man.write( jos ); + jos.close(); + + return file; + } + + private void createArgFile( String filePath, List lines ) + throws IOException + { + final String EOL = System.getProperty( "line.separator", "\\n" ); + + FileWriter writer = null; + try + { + writer = new FileWriter( filePath ); + for ( String line : lines ) + { + writer.append( line ).append( EOL ); + } + + } + finally + { + IOUtil.close( writer ); + } + } + + protected Map createEnvs( File envScriptFile ) + throws MojoExecutionException + { + Map results = null; + + File tmpEnvExecFile = null; + try + { + tmpEnvExecFile = this.createEnvWrapperFile( envScriptFile ); + + Commandline cl = new Commandline();// commons-exec instead? + cl.setExecutable( tmpEnvExecFile.getAbsolutePath() ); + if ( !OS.isFamilyWindows() ) + { + cl.setExecutable( "sh" ); + cl.createArg().setFile( tmpEnvExecFile ); + } + + // pickup the initial env vars so that the env script can used if necessary + if ( environmentVariables != null ) + { + for ( Map.Entry item : environmentVariables.entrySet() ) + { + cl.addEnvironment( item.getKey(), item.getValue() ); + } + } + + EnvStreamConsumer stdout = new EnvStreamConsumer(); + StreamConsumer stderr = new DefaultConsumer(); + + CommandLineUtils.executeCommandLine( cl, stdout, stderr ); + + results = stdout.getParsedEnv(); + } + catch ( CommandLineException e ) + { + throw new MojoExecutionException( e.getMessage() ); + } + catch ( IOException e ) + { + throw new MojoExecutionException( e.getMessage() ); + } + finally + { + if ( tmpEnvExecFile != null ) + { + tmpEnvExecFile.delete(); + } + } + + return results; + + } + + protected File createEnvWrapperFile( File envScript ) + throws IOException + { + PrintWriter writer = null; + File tmpFile = null; + try + { + + if ( OS.isFamilyWindows() ) + { + tmpFile = File.createTempFile( "env", ".bat" ); + writer = new PrintWriter( tmpFile ); + writer.append( "@echo off" ).println(); + writer.append( "call \"" ).append( envScript.getCanonicalPath() ).append( "\"" ).println(); + writer.append( "echo " + EnvStreamConsumer.START_PARSING_INDICATOR ).println(); + writer.append( "set" ).println(); + writer.flush(); + } + else + { + tmpFile = File.createTempFile( "env", ".sh" ); + // tmpFile.setExecutable( true );//java 6 only + writer = new PrintWriter( tmpFile ); + writer.append( "#! /bin/sh" ).println(); + writer.append( ". " ).append( envScript.getCanonicalPath() ).println(); // works on all unix?? + writer.append( "echo " + EnvStreamConsumer.START_PARSING_INDICATOR ).println(); + writer.append( "env" ).println(); + writer.flush(); + } + } + finally + { + IOUtil.close( writer ); + } + + return tmpFile; + + } + + protected ProcessDestroyer getProcessDestroyer() + { + if ( processDestroyer == null ) + { + processDestroyer = new ShutdownHookProcessDestroyer(); + } + return processDestroyer; + } } diff -Nru exec-maven-plugin-1.1.1+dfsg/src/main/java/org/codehaus/mojo/exec/ExecutableDependency.java exec-maven-plugin-1.6.0/src/main/java/org/codehaus/mojo/exec/ExecutableDependency.java --- exec-maven-plugin-1.1.1+dfsg/src/main/java/org/codehaus/mojo/exec/ExecutableDependency.java 2009-11-26 14:32:11.000000000 +0000 +++ exec-maven-plugin-1.6.0/src/main/java/org/codehaus/mojo/exec/ExecutableDependency.java 2017-03-02 20:58:24.000000000 +0000 @@ -1,25 +1,30 @@ package org.codehaus.mojo.exec; /* - * Copyright 2005-2006 The Codehaus. + * 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 * - * 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 * - * 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. + * 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. */ import org.apache.maven.artifact.Artifact; /** - * + *

+ * ExecutableDependency class. + *

*/ public class ExecutableDependency { @@ -27,48 +32,82 @@ private String artifactId; - public ExecutableDependency() - { - } - + /** + *

+ * Getter for the field groupId. + *

+ * + * @return a {@link java.lang.String} object. + */ public String getGroupId() { return this.groupId; } + /** + *

+ * Setter for the field groupId. + *

+ * + * @param groupId a {@link java.lang.String} object. + */ public void setGroupId( String groupId ) { this.groupId = groupId; } + /** + *

+ * Getter for the field artifactId. + *

+ * + * @return a {@link java.lang.String} object. + */ public String getArtifactId() { return this.artifactId; } + /** + *

+ * Setter for the field artifactId. + *

+ * + * @param artifactId a {@link java.lang.String} object. + */ public void setArtifactId( String artifactId ) { this.artifactId = artifactId; } + /** + *

+ * Matches the groupId and artifactId. + *

+ * + * @param artifact a {@link org.apache.maven.artifact.Artifact} object. + * @return true if both math, false otherwise. + */ public boolean matches( Artifact artifact ) { return artifact.getGroupId().equals( this.getGroupId() ) && artifact.getArtifactId().equals( this.getArtifactId() ); } + /** {@inheritDoc} */ public String toString() { return this.groupId + ":" + this.artifactId; } + /** {@inheritDoc} */ public boolean equals( Object o ) { if ( this == o ) { return true; } - if ( o == null || getClass() != o.getClass() ) + if ( !( o instanceof ExecutableDependency ) ) { return false; } @@ -87,6 +126,7 @@ return true; } + /** {@inheritDoc} */ public int hashCode() { int result; diff -Nru exec-maven-plugin-1.1.1+dfsg/src/main/java/org/codehaus/mojo/exec/Modulepath.java exec-maven-plugin-1.6.0/src/main/java/org/codehaus/mojo/exec/Modulepath.java --- exec-maven-plugin-1.1.1+dfsg/src/main/java/org/codehaus/mojo/exec/Modulepath.java 1970-01-01 00:00:00.000000000 +0000 +++ exec-maven-plugin-1.6.0/src/main/java/org/codehaus/mojo/exec/Modulepath.java 2017-03-02 20:58:24.000000000 +0000 @@ -0,0 +1,27 @@ +package org.codehaus.mojo.exec; + +/* + * 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. + */ + +/** + * @author Jerome Lacoste (jerome@coffeebreaks.org) + */ +public class Modulepath extends AbstractPath +{ +} diff -Nru exec-maven-plugin-1.1.1+dfsg/src/main/java/org/codehaus/mojo/exec/PathsToolchainFactory.java exec-maven-plugin-1.6.0/src/main/java/org/codehaus/mojo/exec/PathsToolchainFactory.java --- exec-maven-plugin-1.1.1+dfsg/src/main/java/org/codehaus/mojo/exec/PathsToolchainFactory.java 1970-01-01 00:00:00.000000000 +0000 +++ exec-maven-plugin-1.6.0/src/main/java/org/codehaus/mojo/exec/PathsToolchainFactory.java 2017-03-02 20:58:24.000000000 +0000 @@ -0,0 +1,157 @@ +package org.codehaus.mojo.exec; + +/* + * 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. + */ + +import java.beans.IntrospectionException; +import java.beans.PropertyDescriptor; +import java.io.File; +import java.lang.reflect.InvocationTargetException; +import java.lang.reflect.Method; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.Properties; + +import org.apache.maven.toolchain.MisconfiguredToolchainException; +import org.apache.maven.toolchain.RequirementMatcherFactory; +import org.apache.maven.toolchain.ToolchainFactory; +import org.apache.maven.toolchain.ToolchainPrivate; +import org.apache.maven.toolchain.model.ToolchainModel; +import org.codehaus.plexus.component.annotations.Component; +import org.codehaus.plexus.component.annotations.Requirement; +import org.codehaus.plexus.logging.Logger; +import org.codehaus.plexus.util.FileUtils; +import org.codehaus.plexus.util.xml.Xpp3Dom; + +/** + * Factory for {@link PathsToolchain}. + * + * @author Markus KARG (markus@headcrashing.eu) + */ +@Component( role = ToolchainFactory.class, hint = "paths" ) +class PathsToolchainFactory + implements ToolchainFactory +{ + + @Requirement + private Logger logger; + + public ToolchainPrivate createToolchain( final ToolchainModel model ) + throws MisconfiguredToolchainException + { + if ( model == null ) + return null; + + final PathsToolchain pathsToolchain = new PathsToolchain( model, this.logger ); + final Properties provides = this.getProvidesProperties( model ); + for ( final Map.Entry provide : provides.entrySet() ) + { + final String key = (String) provide.getKey(); + final String value = (String) provide.getValue(); + if ( value == null ) + throw new MisconfiguredToolchainException( "Provides token '" + key + + "' doesn't have any value configured." ); + + pathsToolchain.addProvideToken( key, RequirementMatcherFactory.createExactMatcher( value ) ); + } + + final Xpp3Dom config = (Xpp3Dom) model.getConfiguration(); + if ( config == null ) + return pathsToolchain; + + final Xpp3Dom pathDom = config.getChild( "paths" ); + if ( pathDom == null ) + return pathsToolchain; + + final Xpp3Dom[] pathDoms = pathDom.getChildren( "path" ); + if ( pathDoms == null || pathDoms.length == 0 ) + return pathsToolchain; + + final List paths = new ArrayList( pathDoms.length ); + for ( final Xpp3Dom pathdom : pathDoms ) + { + final String pathString = pathdom.getValue(); + + if ( pathString == null ) + throw new MisconfiguredToolchainException( "path element is empty" ); + + final String normalizedPath = FileUtils.normalize( pathString ); + final File file = new File( normalizedPath ); + if ( !file.exists() ) + throw new MisconfiguredToolchainException( "Non-existing path '" + file.getAbsolutePath() + "'" ); + + paths.add( normalizedPath ); + } + + pathsToolchain.setPaths( paths ); + + return pathsToolchain; + } + + public ToolchainPrivate createDefaultToolchain() + { + return null; + } + + protected Properties getProvidesProperties( final ToolchainModel model ) + { + final Object value = this.getBeanProperty( model, "provides" ); + + return value instanceof Properties ? (Properties) value : toProperties( (Xpp3Dom) value ); + } + + protected static Properties toProperties( final Xpp3Dom dom ) + { + final Properties props = new Properties(); + + final Xpp3Dom[] children = dom.getChildren(); + for ( final Xpp3Dom child : children ) + props.put( child.getName(), child.getValue() ); + + return props; + } + + protected Object getBeanProperty( final Object obj, final String property ) + { + try + { + final Method method = new PropertyDescriptor( property, obj.getClass() ).getReadMethod(); + + return method.invoke( obj ); + } + catch ( final IntrospectionException e ) + { + throw new RuntimeException( "Incompatible toolchain API", e ); + } + catch ( final IllegalAccessException e ) + { + throw new RuntimeException( "Incompatible toolchain API", e ); + } + catch ( final InvocationTargetException e ) + { + final Throwable cause = e.getCause(); + + if ( cause instanceof RuntimeException ) + throw (RuntimeException) cause; + + throw new RuntimeException( "Incompatible toolchain API", e ); + } + } +} diff -Nru exec-maven-plugin-1.1.1+dfsg/src/main/java/org/codehaus/mojo/exec/PathsToolchain.java exec-maven-plugin-1.6.0/src/main/java/org/codehaus/mojo/exec/PathsToolchain.java --- exec-maven-plugin-1.1.1+dfsg/src/main/java/org/codehaus/mojo/exec/PathsToolchain.java 1970-01-01 00:00:00.000000000 +0000 +++ exec-maven-plugin-1.6.0/src/main/java/org/codehaus/mojo/exec/PathsToolchain.java 2017-03-02 20:58:24.000000000 +0000 @@ -0,0 +1,63 @@ +package org.codehaus.mojo.exec; + +/* + * 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. + */ + +import java.util.List; + +import org.apache.maven.toolchain.DefaultToolchain; +import org.apache.maven.toolchain.model.ToolchainModel; +import org.codehaus.plexus.logging.Logger; + +/** + * Searches a list of configured paths for the requested tool. + * + * @author Markus KARG (markus@headcrashing.eu) + */ +class PathsToolchain + extends DefaultToolchain +{ + private List paths; + + public PathsToolchain( final ToolchainModel model, final Logger logger ) + { + super( model, "paths", logger ); // NOI18N + } + + public List getPaths() + { + return this.paths; + } + + public void setPaths( final List paths ) + { + this.paths = paths; + } + + @Override + public String toString() + { + return "Paths" + this.getPaths(); // NOI18N + } + + public String findTool( final String toolName ) + { + return ExecMojo.findExecutable( toolName, this.paths ); + } +} \ No newline at end of file diff -Nru exec-maven-plugin-1.1.1+dfsg/src/main/java/org/codehaus/mojo/exec/Property.java exec-maven-plugin-1.6.0/src/main/java/org/codehaus/mojo/exec/Property.java --- exec-maven-plugin-1.1.1+dfsg/src/main/java/org/codehaus/mojo/exec/Property.java 2009-11-26 14:32:11.000000000 +0000 +++ exec-maven-plugin-1.6.0/src/main/java/org/codehaus/mojo/exec/Property.java 2017-03-02 20:58:24.000000000 +0000 @@ -1,25 +1,28 @@ package org.codehaus.mojo.exec; /* - * Copyright 2005 The Codehaus. + * 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 * - * 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 * - * 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. + * 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. */ /** * Wrapper class for the systemPropery argument type. - * - * @author Kaare Nilsen + * + * @author Kaare Nilsen (kaare.nilsen@gmail.com) */ public class Property { @@ -27,21 +30,49 @@ private String value; + /** + *

+ * Getter for the field key. + *

+ * + * @return a {@link java.lang.String} object. + */ public String getKey() { return key; } + /** + *

+ * Setter for the field key. + *

+ * + * @param key a {@link java.lang.String} object. + */ public void setKey( String key ) { this.key = key; } + /** + *

+ * Getter for the field value. + *

+ * + * @return a {@link java.lang.String} object. + */ public String getValue() { return value; } + /** + *

+ * Setter for the field value. + *

+ * + * @param value a {@link java.lang.String} object. + */ public void setValue( String value ) { this.value = value; diff -Nru exec-maven-plugin-1.1.1+dfsg/src/main/java/org/codehaus/mojo/exec/StreamLog.java exec-maven-plugin-1.6.0/src/main/java/org/codehaus/mojo/exec/StreamLog.java --- exec-maven-plugin-1.1.1+dfsg/src/main/java/org/codehaus/mojo/exec/StreamLog.java 2009-11-26 14:32:11.000000000 +0000 +++ exec-maven-plugin-1.6.0/src/main/java/org/codehaus/mojo/exec/StreamLog.java 2017-03-02 20:58:24.000000000 +0000 @@ -1,23 +1,47 @@ package org.codehaus.mojo.exec; +/* + * 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. + */ + import java.io.PrintStream; + import org.apache.maven.plugin.logging.Log; /** * a Simple Maven Log that outputs to a Stream */ -class StreamLog implements Log +class StreamLog + implements Log { static final int DEBUG = 0; - static final int INFO = 1; - static final int WARN = 2; + + static final int INFO = 1; + + static final int WARN = 2; + static final int ERROR = 3; private int level = INFO; public void setLevel( int level ) { - if ( level < DEBUG || level > ERROR ) + if ( level < DEBUG || level > ERROR ) { throw new IllegalStateException( "invalid level: " + level ); } @@ -29,7 +53,7 @@ StreamLog( PrintStream s ) { this.s = s; - } + } public void debug( CharSequence content ) { @@ -38,7 +62,7 @@ s.println( content ); } } - + public void debug( CharSequence content, Throwable error ) { if ( isDebugEnabled() ) @@ -46,7 +70,7 @@ s.println( content ); } } - + public void debug( Throwable error ) { if ( isDebugEnabled() ) @@ -54,7 +78,7 @@ error.printStackTrace( s ); } } - + public void error( CharSequence content ) { if ( isErrorEnabled() ) @@ -62,13 +86,13 @@ s.println( content ); } } - + public void error( CharSequence content, Throwable error ) { error( content ); error( error ); } - + public void error( Throwable error ) { if ( isErrorEnabled() ) @@ -76,7 +100,7 @@ error.printStackTrace( s ); } } - + public void info( CharSequence content ) { if ( isInfoEnabled() ) @@ -84,13 +108,13 @@ s.println( content ); } } - + public void info( CharSequence content, Throwable error ) { info( content ); info( error ); } - + public void info( Throwable error ) { if ( isInfoEnabled() ) @@ -98,27 +122,27 @@ error.printStackTrace( s ); } } - + public boolean isDebugEnabled() { return level >= DEBUG; } - + public boolean isErrorEnabled() { return level >= ERROR; } - + public boolean isInfoEnabled() { return level >= INFO; } - + public boolean isWarnEnabled() { return level >= WARN; } - + public void warn( CharSequence content ) { if ( isWarnEnabled() ) @@ -126,13 +150,13 @@ s.println( content ); } } - + public void warn( CharSequence content, Throwable error ) { warn( content ); warn( error ); } - + public void warn( Throwable error ) { if ( isWarnEnabled() ) diff -Nru exec-maven-plugin-1.1.1+dfsg/src/site/apt/examples/example-exec-for-java-programs.apt exec-maven-plugin-1.6.0/src/site/apt/examples/example-exec-for-java-programs.apt --- exec-maven-plugin-1.1.1+dfsg/src/site/apt/examples/example-exec-for-java-programs.apt 2009-11-26 14:32:11.000000000 +0000 +++ exec-maven-plugin-1.6.0/src/site/apt/examples/example-exec-for-java-programs.apt 1970-01-01 00:00:00.000000000 +0000 @@ -1,84 +0,0 @@ - ------ - Running Java programs with the exec goal - ------ - Jerome Lacoste - ------ - 2008-10-10 - ------ - - ~~ Copyright 2008 The Codehaus - ~~ - ~~ 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. - - ~~ NOTE: For help with the syntax of this file, see: - ~~ http://maven.apache.org/doxia/references/apt-format.html - -Running Java programs with the exec goal - - Special treatment of some command line arguments and configuration parameters facilitate the running of Java programs in external processes. - - Note: with the java mojo, there are some confusion caused by the almost duplication of functionality between the arguments and commandArgs configuration parameters. - - * If commandLineArgs is specified, it will be used as is, except for replacing %classpath with proper classpath using dependencies - - * Otherwise if the property exec.args is specified, it will be used - - * Otherwise the list of and will be parsed and used - - See {{http://jira.codehaus.org/browse/MEXEC-59}} for discussion. - -* Command line - - If specified as part of the <<>> argument, the special string <<<%classpath>>> - will be replaced by the project classpath as computed by Maven. - ------ -mvn exec:exec -Dexec.executable="java" [...] -Dexec.args="%classpath" ------ - -* POM configuration - - To execute Java programs, the Exec Plugin helps by allowing the <<<\>>> special argument: - -------------------- - - java - - -Dmyproperty=myvalue - -classpath - - - com.example.Main - ... - - -------------------- - - or if one wants to restrict the dependencies in the classpath: - -------------------- - - java - - -Dmyproperty=myvalue - -classpath - - commons-io:commons-io - commons-lang:commons-lang - - com.example.Main - ... - - -------------------- diff -Nru exec-maven-plugin-1.1.1+dfsg/src/site/apt/examples/example-exec-for-java-programs.apt.vm exec-maven-plugin-1.6.0/src/site/apt/examples/example-exec-for-java-programs.apt.vm --- exec-maven-plugin-1.1.1+dfsg/src/site/apt/examples/example-exec-for-java-programs.apt.vm 1970-01-01 00:00:00.000000000 +0000 +++ exec-maven-plugin-1.6.0/src/site/apt/examples/example-exec-for-java-programs.apt.vm 2017-03-02 20:58:24.000000000 +0000 @@ -0,0 +1,99 @@ + ------ + Running Java programs with the exec goal + ------ + Jerome Lacoste + ------ + 2008-10-10 + ------ + + ~~ Copyright 2008 The Codehaus + ~~ + ~~ 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. + + ~~ NOTE: For help with the syntax of this file, see: + ~~ http://maven.apache.org/doxia/references/apt-format.html + +Running Java programs with the exec goal + + Special treatment of some command line arguments and configuration parameters facilitate the running of Java programs in external processes. + + Note: With the <<>> goal, there are some confusion caused by the almost duplication of functionality between the <<>> and + <<>> configuration parameters. + + * If <<>> is specified, it will be used as is, except for replacing %classpath and %modulepath with their matching path using dependencies + + * Otherwise if the property <<>> is specified, it will be used + + * Otherwise the list of , and will be parsed and used + + +* Command line + + If specified as part of the <<>> argument, the special string <<<%classpath>>> + will be replaced by the project classpath as computed by Maven. Same couunts for <<<%modulepath>>> + +----- +mvn exec:exec -Dexec.executable="java" [...] -Dexec.args="%classpath" +----- + +* POM configuration + + To execute Java programs, the Exec Maven Plugin helps by allowing the <<<\>>> special argument: + +------------------- + + java + + -classpath + + + com.example.Main + ... + + +------------------- + + or if one wants to restrict the dependencies in the classpath: + +------------------- + + java + + -classpath + + commons-io:commons-io + commons-lang:commons-lang + + com.example.Main + ... + + +------------------- + +In case of the modules as supported since Java9 the configuration looks like + +------------------- + + java + + --module-path + + + --module + mymodule/com.example.Main + ... + + +------------------- diff -Nru exec-maven-plugin-1.1.1+dfsg/src/site/apt/examples/example-exec-or-java-change-classpath-scope.apt exec-maven-plugin-1.6.0/src/site/apt/examples/example-exec-or-java-change-classpath-scope.apt --- exec-maven-plugin-1.1.1+dfsg/src/site/apt/examples/example-exec-or-java-change-classpath-scope.apt 2009-11-26 14:32:11.000000000 +0000 +++ exec-maven-plugin-1.6.0/src/site/apt/examples/example-exec-or-java-change-classpath-scope.apt 1970-01-01 00:00:00.000000000 +0000 @@ -1,44 +0,0 @@ - ------ - Changing the classpath scope - ------ - Jerome Lacoste - ------ - 2008-10-10 - ------ - - ~~ Copyright 2008 The Codehaus - ~~ - ~~ 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. - - ~~ NOTE: For help with the syntax of this file, see: - ~~ http://maven.apache.org/doxia/references/apt-format.html - -Changing the classpath scope when running Java programs - - Whether you use the <<>> goal or the special support of Java for the <<>> goal, you might want - to change the scope of the plugin execution. This can be achieved using the <<>> configuration element, - e.g. for a <<>> scope: - -------------------- - - ... - test - ... - -------------------- - - or, on the command line, - ------ -mvn exec:exec [...] -Dexec.classpathScope="java" ------ diff -Nru exec-maven-plugin-1.1.1+dfsg/src/site/apt/examples/example-exec-or-java-change-classpath-scope.apt.vm exec-maven-plugin-1.6.0/src/site/apt/examples/example-exec-or-java-change-classpath-scope.apt.vm --- exec-maven-plugin-1.1.1+dfsg/src/site/apt/examples/example-exec-or-java-change-classpath-scope.apt.vm 1970-01-01 00:00:00.000000000 +0000 +++ exec-maven-plugin-1.6.0/src/site/apt/examples/example-exec-or-java-change-classpath-scope.apt.vm 2017-03-02 20:58:24.000000000 +0000 @@ -0,0 +1,44 @@ + ------ + Changing the classpath scope + ------ + Jerome Lacoste + ------ + 2008-10-10 + ------ + + ~~ Copyright 2008 The Codehaus + ~~ + ~~ 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. + + ~~ NOTE: For help with the syntax of this file, see: + ~~ http://maven.apache.org/doxia/references/apt-format.html + +Changing the classpath scope when running Java programs + + Whether you use the <<>> goal or the special support of Java for the <<>> goal, you might want + to change the scope of the plugin execution. This can be achieved using the <<>> configuration element, + e.g. for a <<>> scope: + +------------------- + + ... + test + ... + +------------------- + + or, on the command line, + +----- +mvn exec:exec [...] -Dexec.classpathScope="java" +----- diff -Nru exec-maven-plugin-1.1.1+dfsg/src/site/apt/examples/example-exec-using-executabledependency.apt.vm exec-maven-plugin-1.6.0/src/site/apt/examples/example-exec-using-executabledependency.apt.vm --- exec-maven-plugin-1.1.1+dfsg/src/site/apt/examples/example-exec-using-executabledependency.apt.vm 1970-01-01 00:00:00.000000000 +0000 +++ exec-maven-plugin-1.6.0/src/site/apt/examples/example-exec-using-executabledependency.apt.vm 2017-03-02 20:58:24.000000000 +0000 @@ -0,0 +1,74 @@ + ------ + Using executable binary dependencies with the exec:exec goal + ------ + Markus KARG + ------ + 2016-05-23 + ------ + + ~~ Copyright 2016 The Codehaus + ~~ + ~~ 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. + + ~~ NOTE: For help with the syntax of this file, see: + ~~ http://maven.apache.org/doxia/references/apt-format.html + + +Using Executable Binary Dependencies Instead of Local Executables + + Instead of invoking a locally installed binary executable (identified by <<>>), a dependency (identified by <<>>) can directly get executed instead. + This particularly is useful when the dependency is an executable binary like <<<.exe>>> or <<<.bat>>> file produced by a different Maven project which got deployed into a repository. + The binary gets pulled to the local repository and is getting executed <> without the need to know its actual file name or location on disk: Just the GA coordinates (<<>>, <<>>) are needed. + Hence the <<>> parameter has to be omitted in favor of the <<>> parameter. + + There are two ways of using executable binary dependencies: Project dependencies and plugin dependencies. Currently the <<>> goal only supports plugin dependencies. + +* Plugin Dependencies + + Plugin Dependencies are referenced from within the plugin configuration. + +** pom.xml + +------------------- + + ... + + + + org.codehaus.mojo + exec-maven-plugin + ${project.version} + ... + + + + your-group + your-artifact + + + + + + your-group + your-artifact + exe + your-version + + + ... + + + + ... + +------------------- diff -Nru exec-maven-plugin-1.1.1+dfsg/src/site/apt/examples/example-exec-using-plugin-dependencies.apt exec-maven-plugin-1.6.0/src/site/apt/examples/example-exec-using-plugin-dependencies.apt --- exec-maven-plugin-1.1.1+dfsg/src/site/apt/examples/example-exec-using-plugin-dependencies.apt 2009-11-26 14:32:11.000000000 +0000 +++ exec-maven-plugin-1.6.0/src/site/apt/examples/example-exec-using-plugin-dependencies.apt 1970-01-01 00:00:00.000000000 +0000 @@ -1,107 +0,0 @@ - ------ - Using plugin dependencies with the exec:java goal - ------ - Jerome Lacoste - ------ - 2008-10-10 - ------ - - ~~ Copyright 2008 The Codehaus - ~~ - ~~ 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. - - ~~ NOTE: For help with the syntax of this file, see: - ~~ http://maven.apache.org/doxia/references/apt-format.html - - -Using Plugin Dependencies Instead of Project Dependencies - - Ocassionally it is desirable to execute a Java class without affecting your project's dependencies. - For example, if you are using the Maven csharp plugins, adding Java dependencies to your project - will upset the csharp compiler. Therefore the Exec Maven Plugin allows you specify dependencies of - your executable class as plugin dependencies. Since Maven takes plugin dependencies into consideration - when determining build order for a multi-module project your build order should automatically be - appropriately adjusted (I think). - - If you specify your executable class dependencies as plugin dependencies, you may end up with extraneous - undesirable dependences required by the Exec Maven Plugin but not by your executable class. If this - causes a problem, or if you simply prefer to avoid the extraneous dependencies you can use the - <<<\>>> configuration element. The <<<\>>> element allows you to identify - the particular artifact in the list of the plugin's dependencies which contains your executable class. - The Exec Maven Plugin will ensure that only the selected artifact identified by the <<<\>>> - configuration element and the selected artifact's transitive dependencies are used when the <<>> - is executed. - - Although the use of the <<<\>>> configuration element will prevent the Java class being - executed from seeing extraneous classes, the Exec Maven Plugin itself will still see all of the plugin - dependencies. For example if your executable Java class has a dependency upon a brand new version of - <<>> and you specify this as a plugin dependency then the Exec Maven Plugin, - which already has a transitive dependency upon <<>>, will end up using - the brand new version you explictly supplied. It is unlikely you will encounter a situation - where this will be a problem, but hopefully this knowledge will help you diagnose such a problem if - it occurs. None of this is relevant unless your using the plugin dependencies for your - executable (<<>>). - -* Example POM Configuration using Plugin Dependencies - -------------------- - - ... - - - - org.codehaus.mojo - exec-maven-plugin - 1.1 - - - ... - - java - - - - - false - true - - com.example.myproject - mylib - - com.example.Main - - argument1 - ... - - - - myproperty - myvalue - - ... - - - - - com.example.myproject - mylib - 1.3.5 - jar - - - - - - ... - -------------------- diff -Nru exec-maven-plugin-1.1.1+dfsg/src/site/apt/examples/example-exec-using-plugin-dependencies.apt.vm exec-maven-plugin-1.6.0/src/site/apt/examples/example-exec-using-plugin-dependencies.apt.vm --- exec-maven-plugin-1.1.1+dfsg/src/site/apt/examples/example-exec-using-plugin-dependencies.apt.vm 1970-01-01 00:00:00.000000000 +0000 +++ exec-maven-plugin-1.6.0/src/site/apt/examples/example-exec-using-plugin-dependencies.apt.vm 2017-03-02 20:58:24.000000000 +0000 @@ -0,0 +1,107 @@ + ------ + Using plugin dependencies with the exec:java goal + ------ + Jerome Lacoste + ------ + 2008-10-10 + ------ + + ~~ Copyright 2008 The Codehaus + ~~ + ~~ 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. + + ~~ NOTE: For help with the syntax of this file, see: + ~~ http://maven.apache.org/doxia/references/apt-format.html + + +Using Plugin Dependencies Instead of Project Dependencies + + Ocassionally it is desirable to execute a Java class without affecting your project's dependencies. + For example, if you are using the Maven csharp plugins, adding Java dependencies to your project + will upset the csharp compiler. Therefore the Exec Maven Plugin allows you specify dependencies of + your executable class as plugin dependencies. Since Maven takes plugin dependencies into consideration + when determining build order for a multi-module project your build order should automatically be + appropriately adjusted (I think). + + If you specify your executable class dependencies as plugin dependencies, you may end up with extraneous + undesirable dependences required by the Exec Maven Plugin but not by your executable class. If this + causes a problem, or if you simply prefer to avoid the extraneous dependencies you can use the + <<<\>>> configuration element. The <<<\>>> element allows you to identify + the particular artifact in the list of the plugin's dependencies which contains your executable class. + The Exec Maven Plugin will ensure that only the selected artifact identified by the <<<\>>> + configuration element and the selected artifact's transitive dependencies are used when the <<>> + is executed. + + Although the use of the <<<\>>> configuration element will prevent the Java class being + executed from seeing extraneous classes, the Exec Maven Plugin itself will still see all of the plugin + dependencies. For example if your executable Java class has a dependency upon a brand new version of + <<>> and you specify this as a plugin dependency then the Exec Maven Plugin, + which already has a transitive dependency upon <<>>, will end up using + the brand new version you explictly supplied. It is unlikely you will encounter a situation + where this will be a problem, but hopefully this knowledge will help you diagnose such a problem if + it occurs. None of this is relevant unless you're using the plugin dependencies for your + executable (<<>>). + +* Example POM Configuration using Plugin Dependencies + +------------------- + + ... + + + + org.codehaus.mojo + exec-maven-plugin + ${project.version} + + + ... + + java + + + + + false + true + + com.example.myproject + mylib + + com.example.Main + + argument1 + ... + + + + myproperty + myvalue + + ... + + + + + com.example.myproject + mylib + 1.3.5 + jar + + + + + + ... + +------------------- diff -Nru exec-maven-plugin-1.1.1+dfsg/src/site/apt/examples/example-exec-using-toolchains.apt.vm exec-maven-plugin-1.6.0/src/site/apt/examples/example-exec-using-toolchains.apt.vm --- exec-maven-plugin-1.1.1+dfsg/src/site/apt/examples/example-exec-using-toolchains.apt.vm 1970-01-01 00:00:00.000000000 +0000 +++ exec-maven-plugin-1.6.0/src/site/apt/examples/example-exec-using-toolchains.apt.vm 2017-03-02 20:58:24.000000000 +0000 @@ -0,0 +1,238 @@ + ------ + Using toolchains with the exec:exec goal + ------ + Markus KARG + ------ + 2016-04-24 + ------ + + ~~ Copyright 2016 The Codehaus + ~~ + ~~ 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. + + ~~ NOTE: For help with the syntax of this file, see: + ~~ http://maven.apache.org/doxia/references/apt-format.html + + +Using Toolchains Instead of Explicit Paths + + To keep both, the POM and the <<>> free of explicit paths, the <<>> goal supports Maven Toolchains. + Toolchains are configured using the file <<>> and apply different algorithms how to find the wanted tool on disk. + More information on toolchains can be found on the {{{https://maven.apache.org/guides/mini/guide-using-toolchains.html}Maven web site}}. + + There are three ways of using toolchains: The "paths" toolchain provided by the Exec Maven Plugin, the "jdk" toolchain provided by the Maven Toolchains Plugin, and custom toolchains provided by third party plugins. + +* The "paths" Toolchain + + The "paths" toolchain is included in the Exec Maven Plugin and must be enabled explicitly in the POM. + It searches a configurable list of folders for the requested tool. + The first match will be invoked. + +** pom.xml + +------------------- + + ... + + + + maven-toolchains-plugin + 1.1 + + + + toolchain + + + + + + + + foo-bar + + + + + + org.codehaus.mojo + exec-maven-plugin + ${project.version} + + true + ... + + paths + + ... + + + + ... + +------------------- + +** toolchains.xml + +------------------- + + + + paths + + + foo-bar + + + + C:\Program Files\FooBar\SDK\bin + C:\Program Files\FooBar\Runtime\bin + + + + ... + +------------------- + +* The "jdk" Toolchain + + The "jdk" toolchain is included in the Maven Toolchains Plugin and enabled by default. + It searches the <<>> folder of the specified JDK for the requested tool. + +** pom.xml + +------------------- + + ... + + + + maven-toolchains-plugin + 1.1 + + + + toolchain + + + + + + + + [1.5,) + + + + + + org.codehaus.mojo + exec-maven-plugin + ${project.version} + ... + + + + ... + +------------------- + +** toolchains.xml + +------------------- + + + + jdk + + + 1.5 + sun + sun-jdk-1.5 + + + C:\Program Files\Java\jdk1.5.0 + + + ... + +------------------- + +* Custom Toolchains + + Custom toolchains are included in third party Maven plugins and must be enabled explicitly in the POM. + Their type id, configuration and search algorithms are plugin specific. + See particular plugin's documentation. + +** pom.xml + +------------------- + + ... + + + + + + + ... + + + maven-toolchains-plugin + 1.1 + + + + toolchain + + + + + + + + + + + org.codehaus.mojo + exec-maven-plugin + ${project.version} + ... + + + + ... + + + + ... + +------------------- + +** toolchains.xml + +------------------- + + + + + + + + + + + + ... + +------------------- diff -Nru exec-maven-plugin-1.1.1+dfsg/src/site/apt/index.apt exec-maven-plugin-1.6.0/src/site/apt/index.apt --- exec-maven-plugin-1.1.1+dfsg/src/site/apt/index.apt 2009-11-26 14:32:11.000000000 +0000 +++ exec-maven-plugin-1.6.0/src/site/apt/index.apt 2017-03-02 20:58:24.000000000 +0000 @@ -1,51 +1,68 @@ - ------ - Introduction - ------ - Jerome Lacoste - ------ - 2008-10-10 - ------ - - ~~ Copyright 2006 The Codehaus - ~~ - ~~ 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. - - ~~ NOTE: For help with the syntax of this file, see: - ~~ http://maven.apache.org/doxia/references/apt-format.html - -Exec Maven Plugin - - The plugin provides 2 goals to help execute system and Java programs. - -* Goals Overview - - General information about the goals. - - * {{{exec-mojo.html}exec:exec}} execute programs and Java programs in a separate process. - - * {{{java-mojo.html}exec:java}} execute Java programs in the same VM. - -* Usage - - Instructions on how to use the Exec Plugin can be found on the {{{usage.html}usage page}}. - -* Examples - - To provide you with better understanding of some usages of the Exec Plugin, - you can take a look into the following examples: - - * {{{examples/example-exec-for-java-programs.html} Running Java programs with exec:exec}} - - * {{{examples/example-exec-or-java-change-classpath-scope.html} Changing the classpath scope when running Java programs}} - - * {{{examples/example-exec-using-plugin-dependencies.html} Using plugin dependencies with exec:exec}} + ------ + Introduction + ------ + Jerome Lacoste + ------ + 2008-10-10 + ------ + + ~~ Copyright 2006 The Codehaus + ~~ + ~~ 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. + + ~~ NOTE: For help with the syntax of this file, see: + ~~ http://maven.apache.org/doxia/references/apt-format.html + +Exec Maven Plugin + + The plugin provides 2 goals to help execute system and Java programs. + +* Goals Overview + + General information about the goals. + + * {{{./exec-mojo.html}exec:exec}} execute programs and Java programs in a separate process. + + * {{{./java-mojo.html}exec:java}} execute Java programs in the same VM. + +* Usage + + General instructions on how to use the Exec Maven Plugin can be found on the {{{./usage.html}usage page}}. + + In case you still have questions regarding the plugin's usage, please feel + free to contact the {{{./mail-lists.html}user mailing list}}. The posts to the mailing list are archived and could + already contain the answer to your question as part of an older thread. Hence, it is also worth browsing/searching + the {{{./mail-lists.html}mail archive}}. + + If you feel like the plugin is missing a feature or has a defect, you can fill a feature request or bug report in our + {{{./issue-tracking.html}issue tracker}}. When creating a new issue, please provide a comprehensive description of your + concern. Especially for fixing bugs it is crucial that the developers can reproduce your problem. For this reason, + entire debug logs, POMs or most preferably little demo projects attached to the issue are very much appreciated. + Of course, patches are most welcome too. Contributors can check out the project from our + {{{./source-repository.html}source repository}} and will find supplementary information in the + {{{http://maven.apache.org/guides/development/guide-helping.html}guide to helping with Maven}}. + +* Examples + + To provide you with better understanding of some usages of the Exec Maven Plugin, + you can take a look into the following examples: + + * {{{./examples/example-exec-for-java-programs.html} Running Java programs with exec:exec}} + + * {{{./examples/example-exec-or-java-change-classpath-scope.html} Changing the classpath scope when running Java programs}} + + * {{{./examples/example-exec-using-plugin-dependencies.html} Using plugin dependencies with exec:exec}} + + * {{{./examples/example-exec-using-toolchains.html} Using toolchains instead of explicit paths}} + + * {{{./examples/example-exec-using-executabledependency.html} Using executable binary dependencies instead of local executables}} diff -Nru exec-maven-plugin-1.1.1+dfsg/src/site/apt/usage.apt exec-maven-plugin-1.6.0/src/site/apt/usage.apt --- exec-maven-plugin-1.1.1+dfsg/src/site/apt/usage.apt 2009-11-26 14:32:11.000000000 +0000 +++ exec-maven-plugin-1.6.0/src/site/apt/usage.apt 1970-01-01 00:00:00.000000000 +0000 @@ -1,164 +0,0 @@ - ------ - Usage - ------ - Jerome Lacoste - ------ - 2008-10-10 - ------ - - ~~ Copyright 2006 The Codehaus - ~~ - ~~ 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. - - ~~ NOTE: For help with the syntax of this file, see: - ~~ http://maven.apache.org/doxia/references/apt-format.html - -Usage - -* Exec goal - - You can formally specify all the relevant execution information in the plugin configuration. - Depending on your use case, you can also specify some or all information using system properties. - -** Command line - - Using system properties you would just execute it like in the following example. - ------ -mvn exec:exec -Dexec.executable="maven" [-Dexec.workingdir="/tmp"] -Dexec.args="-X myproject:dist" ------ - -** POM Configuration - - Add a configuration similar to the following to your POM: - -------------------- - - ... - - - - org.codehaus.mojo - exec-maven-plugin - 1.1 - - - ... - - exec - - - - - maven - - /tmp - - -X - myproject:dist - ... - - - - - - ... - -------------------- - -* Java goal - - This goal helps you run a Java program within the same VM as Maven. - -** Differences compared to plain command line - - The goal goes to great length to try to mimic the way the VM works, but there are some small subttle differences. - Today all differences come from the way the goal deals with <>. - -*--------------------------------------+------------------------------------------+ -| command line | Java Mojo | -*--------------------------------------+------------------------------------------+ -| The VM exits as soon as the only | By default daemon threads are joined | -| remaining threads are daemon threads | and interrupted once all known non | -| | daemon threads have quitted. The join | -| | timeout is customisable | -| | The user might wish to further cleanup | -| | cleanup by stopping the unresponsive | -| | threads. | -| | The user can disable the full extra | -| | thread management (interrupt/join/[stop])| -*--------------------------------------+------------------------------------------+ - - Read the documentation for the {{{java-mojo.html}java goal}} for more information on how to configure this behavior. - - If you find out that these differences are unacceptable for your case, you may need to use the {{{exec-mojo.html} exec goal}} to wrap your Java executable. - -** Command line - - If you want to execute Java programs in the same VM, you can either use the command line version - ------ -mvn exec:java -Dexec.mainClass="com.example.Main" [-Dexec.args="argument1"] ... ------ - -** POM Configuration - - or you can configure the plugin in your POM: - -------------------- - - ... - - - - org.codehaus.mojo - exec-maven-plugin - 1.1 - - - ... - - java - - - - - com.example.Main - - argument1 - ... - - - - myproperty - myvalue - - ... - - - - - - ... - -------------------- - - <> The <<>> goal doesn't spawn a new process. Any VM specific option that you want to pass to the executed class must be passed to the Maven VM using - the <<>> environment variable. - E.g. - -------------------- -MAVEN_OPTS=-Xmx1024m -------------------- - - Otherwise consider using the <<>> goal. diff -Nru exec-maven-plugin-1.1.1+dfsg/src/site/apt/usage.apt.vm exec-maven-plugin-1.6.0/src/site/apt/usage.apt.vm --- exec-maven-plugin-1.1.1+dfsg/src/site/apt/usage.apt.vm 1970-01-01 00:00:00.000000000 +0000 +++ exec-maven-plugin-1.6.0/src/site/apt/usage.apt.vm 2017-03-02 20:58:24.000000000 +0000 @@ -0,0 +1,164 @@ + ------ + Usage + ------ + Jerome Lacoste + ------ + 2008-10-10 + ------ + + ~~ Copyright 2006 The Codehaus + ~~ + ~~ 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. + + ~~ NOTE: For help with the syntax of this file, see: + ~~ http://maven.apache.org/doxia/references/apt-format.html + +Usage + +* Exec goal + + You can formally specify all the relevant execution information in the plugin configuration. + Depending on your use case, you can also specify some or all information using system properties. + +** Command line + + Using system properties you would just execute it like in the following example. + +----- +mvn exec:exec -Dexec.executable="maven" [-Dexec.workingdir="/tmp"] -Dexec.args="-X myproject:dist" +----- + +** POM Configuration + + Add a configuration similar to the following to your POM: + +------------------- + + ... + + + + org.codehaus.mojo + exec-maven-plugin + ${project.version} + + + ... + + exec + + + + + maven + + /tmp + + -X + myproject:dist + ... + + + + + + ... + +------------------- + +* Java goal + + This goal helps you run a Java program within the same VM as Maven. + +** Differences compared to plain command line + + The goal goes to great length to try to mimic the way the VM works, but there are some small subttle differences. + Today all differences come from the way the goal deals with <>. + +*--------------------------------------+------------------------------------------+ +| command line | Java Mojo | +*--------------------------------------+------------------------------------------+ +| The VM exits as soon as the only | By default daemon threads are joined | +| remaining threads are daemon threads | and interrupted once all known non | +| | daemon threads have quitted. The join | +| | timeout is customisable | +| | The user might wish to further cleanup | +| | cleanup by stopping the unresponsive | +| | threads. | +| | The user can disable the full extra | +| | thread management (interrupt/join/[stop])| +*--------------------------------------+------------------------------------------+ + + Read the documentation for the {{{./java-mojo.html}java goal}} for more information on how to configure this behavior. + + If you find out that these differences are unacceptable for your case, you may need to use the {{{./exec-mojo.html} exec goal}} to wrap your Java executable. + +** Command line + + If you want to execute Java programs in the same VM, you can either use the command line version + +----- +mvn exec:java -Dexec.mainClass="com.example.Main" [-Dexec.args="argument1"] ... +----- + +** POM Configuration + + or you can configure the plugin in your POM: + +------------------- + + ... + + + + org.codehaus.mojo + exec-maven-plugin + ${project.version} + + + ... + + java + + + + + com.example.Main + + argument1 + ... + + + + myproperty + myvalue + + ... + + + + + + ... + +------------------- + + <> The <<>> goal doesn't spawn a new process. Any VM specific option that you want to pass to the executed class must be passed to the Maven VM using + the <<>> environment variable. + E.g. + +------------------- +MAVEN_OPTS=-Xmx1024m +------------------- + + Otherwise consider using the <<>> goal. diff -Nru exec-maven-plugin-1.1.1+dfsg/src/site/site.xml exec-maven-plugin-1.6.0/src/site/site.xml --- exec-maven-plugin-1.1.1+dfsg/src/site/site.xml 2009-11-26 14:32:11.000000000 +0000 +++ exec-maven-plugin-1.6.0/src/site/site.xml 2017-03-02 20:58:24.000000000 +0000 @@ -1,18 +1,19 @@ - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + diff -Nru exec-maven-plugin-1.1.1+dfsg/src/test/groovy/IntegrationBase.groovy exec-maven-plugin-1.6.0/src/test/groovy/IntegrationBase.groovy --- exec-maven-plugin-1.1.1+dfsg/src/test/groovy/IntegrationBase.groovy 1970-01-01 00:00:00.000000000 +0000 +++ exec-maven-plugin-1.6.0/src/test/groovy/IntegrationBase.groovy 2017-03-02 20:58:24.000000000 +0000 @@ -0,0 +1,27 @@ +class IntegrationBase { + + void checkExistenceAndContentOfAFile(file, contents) { + if (!file.canRead()) { + throw new FileNotFoundException( "Could not find the " + file); + } + + def lines_to_check_in_unix_script_marker = [:]; + (0..contents.size()).each { index -> + lines_to_check_in_unix_script_marker[index] = false + } + + file.eachLine { file_content, file_line -> + contents.eachWithIndex { contents_expected, index -> + if (file_content.equals(contents_expected)) { + lines_to_check_in_unix_script_marker[index] = true; + } + } + } + + contents.eachWithIndex { value, index -> + if ( lines_to_check_in_unix_script_marker[index] == false ) { + throw new Exception("The expected content in " + file + " couldn't be found." + contents[index]); + } + } + } +} diff -Nru exec-maven-plugin-1.1.1+dfsg/src/test/java/org/codehaus/mojo/exec/DummyMain.java exec-maven-plugin-1.6.0/src/test/java/org/codehaus/mojo/exec/DummyMain.java --- exec-maven-plugin-1.1.1+dfsg/src/test/java/org/codehaus/mojo/exec/DummyMain.java 2009-11-26 14:32:09.000000000 +0000 +++ exec-maven-plugin-1.6.0/src/test/java/org/codehaus/mojo/exec/DummyMain.java 2017-03-02 20:58:24.000000000 +0000 @@ -2,24 +2,24 @@ /** * Simple class with a main method to call from unit tests - * - * @author Jerome Lacoste - * @version $Id: DummyMain.java 6588 2008-03-28 12:22:57Z bentmann $ + * + * @author Jerome Lacoste + * @version $Id$ */ public class DummyMain { /** * Prints Hello followed by each argument, then a new line. Use a space character as separator. - * - * @param args + * + * @param args the arguments */ - public static void main( String[] args ) + public static void main( String... args ) { - StringBuffer buffer = new StringBuffer( "Hello" ); + StringBuilder buffer = new StringBuilder( "Hello" ); - for ( int i = 0; i < args.length; i++ ) + for ( String arg : args ) { - buffer.append( System.getProperty( "line.separator" ) ).append( args[i] ); + buffer.append( System.getProperty( "line.separator" ) ).append( arg ); } System.out.println( buffer.toString() ); diff -Nru exec-maven-plugin-1.1.1+dfsg/src/test/java/org/codehaus/mojo/exec/ExecJavaMojoTest.java exec-maven-plugin-1.6.0/src/test/java/org/codehaus/mojo/exec/ExecJavaMojoTest.java --- exec-maven-plugin-1.1.1+dfsg/src/test/java/org/codehaus/mojo/exec/ExecJavaMojoTest.java 2009-11-26 14:32:09.000000000 +0000 +++ exec-maven-plugin-1.6.0/src/test/java/org/codehaus/mojo/exec/ExecJavaMojoTest.java 2017-03-02 20:58:24.000000000 +0000 @@ -16,49 +16,42 @@ * limitations under the License. */ +import java.io.File; +import java.io.IOException; +import java.io.PrintStream; + import org.apache.maven.artifact.repository.ArtifactRepository; import org.apache.maven.artifact.repository.DefaultArtifactRepository; import org.apache.maven.artifact.repository.layout.ArtifactRepositoryLayout; -import org.apache.maven.plugin.MojoExecutionException; +import org.apache.maven.monitor.logging.DefaultLog; import org.apache.maven.plugin.AbstractMojo; +import org.apache.maven.plugin.MojoExecutionException; import org.apache.maven.plugin.testing.AbstractMojoTestCase; import org.apache.maven.project.MavenProject; import org.apache.maven.project.MavenProjectBuilder; -import org.apache.maven.monitor.logging.DefaultLog; -import org.codehaus.plexus.util.StringOutputStream; import org.codehaus.plexus.logging.Logger; import org.codehaus.plexus.logging.console.ConsoleLogger; - -import java.io.File; -import java.io.PrintStream; +import org.codehaus.plexus.util.StringOutputStream; /** - * @author Jerome Lacoste - * @version $Id: ExecJavaMojoTest.java 6914 2008-05-07 21:44:49Z lacostej $ + * @author Jerome Lacoste + * @version $Id$ */ public class ExecJavaMojoTest extends AbstractMojoTestCase { /* - This one won't work yet - public void xxtestSimpleRunPropertiesAndArguments() - throws MojoExecutionException, Exception - { - File pom = new File( getBasedir(), "src/test/projects/project2/pom.xml" ); - - String output = execute( pom, "java" ); - - System.out.println(output); - - assertEquals( -1, output.trim().indexOf( "ERROR" ) ); - } - */ + * This one won't work yet public void xxtestSimpleRunPropertiesAndArguments() throws MojoExecutionException, + * Exception { File pom = new File( getBasedir(), "src/test/projects/project2/pom.xml" ); String output = execute( + * pom, "java" ); System.out.println(output); assertEquals( -1, output.trim().indexOf( "ERROR" ) ); } + */ /** - * Check that a simple execution with no arguments and no system properties produces the expected result - *

- * we load the config from a pom file and fill up the MavenProject property ourselves + * Check that a simple execution with no arguments and no system properties produces the expected result.
+ * We load the config from a pom file and fill up the MavenProject property ourselves + * + * @throws Exception if any exception occurs */ public void testSimpleRun() throws Exception @@ -71,66 +64,100 @@ } /** - * MEXEC-10 Check that an execution with no arguments and an system property with no value - * produces the expected result - *

- * we load the config from a pom file and fill up the MavenProject property ourselves + * MEXEC-10 Check that an execution with no arguments and an system property with no value produces the expected + * result
+ * We load the config from a pom file and fill up the MavenProject property ourselves + * + * @throws Exception if any exception occurs */ public void testEmptySystemProperty() throws Exception { File pom = new File( getBasedir(), "src/test/projects/project5/pom.xml" ); - assertNull( "System property not yet created", - System.getProperty( "project5.property.with.no.value" ) ); + assertNull( "System property not yet created", System.getProperty( "project5.property.with.no.value" ) ); execute( pom, "java" ); - assertEquals( "System property now empty", - "", - System.getProperty( "project5.property.with.no.value" ) ); + assertEquals( "System property now empty", "", System.getProperty( "project5.property.with.no.value" ) ); } /** - * MEXEC-29 exec:java throws NPE if the mainClass main method has not a correct signature - *

+ * Check that an execution that throws propagates the cause of the failure into the output + * and correctly unwraps the InvocationTargetException. + * + * @author Lukasz Cwik + * @throws Exception if any exception occurs */ - public void testIncorrectMainMethodSignature() + public void testRunWhichThrowsExceptionIsNotWrappedInInvocationTargetException() throws Exception { - File pom = new File( getBasedir(), "src/test/projects/project12/pom.xml" ); + File pom = new File( getBasedir(), "src/test/projects/project15/pom.xml" ); - try { - String output = execute( pom, "java" ); - } catch (MojoExecutionException e) { - assertTrue( stringContains( e.getMessage(), "The specified mainClass doesn't contain a main method with appropriate signature." ) ); - } + try + { + execute( pom, "java" ); + + fail( "Expected Exception to be thrown but none was thrown" ); + } + catch ( Throwable e ) + { + assertTrue( e instanceof MojoExecutionException ); + + assertTrue( e.getCause() instanceof IOException ); + assertEquals( "expected IOException thrown by test", e.getCause().getMessage() ); + } } -// this test doesn't work as the classpath passed to the project when executing the POM isn't the same as when maven is executed from within the project dir -// Should be moved as an integration-test -/* - public void testSetClasspathScopeToTest() - throws Exception - { - File pom = new File( getBasedir(), "src/test/projects/project14/pom.xml" ); + /** + * MEXEC-29 exec:java throws NPE if the mainClass main method has not a correct signature + */ + // Moved this test to src/it/mexec-29 (integration test) + // cause it will fail. This is based of trying to + // using dependencies (commons-logging:1.0.4:jar; commons-io:commons-is:1.1) which will be resolved + // against maven central which will not work always in particular + // when maven central is proxied via a repository manager. + // This could be solved by using the local settings.xml + // file of the user, but the tests don't use it. + // Apart from that if the class does not exist as in this test + // the real execution of the plugin will result in a ClassNotFoundException + // like this: + // [DEBUG] Adding project dependency artifact: commons-io to classpath + // [DEBUG] Adding project dependency artifact: commons-logging to classpath + // [DEBUG] joining on thread Thread[org.codehaus.mojo.exec.NoMain.main(),5,org.codehaus.mojo.exec.NoMain] + // [WARNING] + // java.lang.ClassNotFoundException: org.codehaus.mojo.exec.NoMain + // at java.net.URLClassLoader$1.run(URLClassLoader.java:366) + // at java.net.URLClassLoader$1.run(URLClassLoader.java:355) + // at java.security.AccessController.doPrivileged(Native Method) + // at java.net.URLClassLoader.findClass(URLClassLoader.java:354) + // at java.lang.ClassLoader.loadClass(ClassLoader.java:423) + // at java.lang.ClassLoader.loadClass(ClassLoader.java:356) + // at org.codehaus.mojo.exec.ExecJavaMojo$1.run(ExecJavaMojo.java:293) + // at java.lang.Thread.run(Thread.java:722) - String output = execute( pom, "java" ); + /* + * public void testIncorrectMainMethodSignature() throws Exception { File pom = new File( getBasedir(), + * "src/test/projects/project12/pom.xml" ); try { String output = execute( pom, "java" ); } catch + * (MojoExecutionException e) { assertTrue( stringContains( e.getMessage(), + * "The specified mainClass doesn't contain a main method with appropriate signature." ) ); } } + */ - assertEquals( "Hello" + System.getProperty( "line.separator" ), output ); - } -*/ - - // java 1.4 compatibility - private boolean stringContains( String str, String sequence ) - { - return str.indexOf( sequence ) != -1; - } + // this test doesn't work as the classpath passed to the project when executing the POM isn't the same as when maven + // is executed from within the project dir + // Should be moved as an integration-test + /* + * public void testSetClasspathScopeToTest() throws Exception { File pom = new File( getBasedir(), + * "src/test/projects/project14/pom.xml" ); String output = execute( pom, "java" ); assertEquals( "Hello" + + * System.getProperty( "line.separator" ), output ); } + */ /** - * For cases where the Java code spawns Threads and main returns soon. - * See MEXEC-6. + * For cases where the Java code spawns Threads and main returns soon. See + * MEXEC-6. + * + * @throws Exception if any exception occurs */ public void testWaitNoDaemonThreads() throws Exception @@ -144,8 +171,10 @@ /** * For cases where the Java code spawns Threads and main returns soon, but code contains non interruptible threads. - * User is required to timeout the execution, otherwise it will hang. - * See MEXEC-15. + * User is required to timeout the execution, otherwise it will hang. See + * MEXEC-15. + * + * @throws Exception if any exception occurs */ public void testWaitNonInterruptibleDaemonThreads() throws Exception @@ -158,8 +187,10 @@ } /** - * See MEXEC-15. - * FIXME: this sometimes fail with unit.framework.ComparisonFailure: expected:<...> but was:<...3(f)> + * See MEXEC-15. FIXME: this sometimes fail with + * unit.framework.ComparisonFailure: expected:<...> but was:<...3(f)> + * + * @throws Exception if any exception occurs */ public void testUncooperativeThread() throws Exception @@ -175,45 +206,36 @@ * See MEXEC-17. */ /** - This test doesn't work because the sun.tools.javac.Main class referenced in the - project pom is found even if the system scope dependencies are not added by the plugin. - The class was probably loaded by another plugin ?! - - To fix the test we have to: - - maybe use a different system scope dependency/class to load. - - find a different way to test. - - When ran manually, the test works though (i.e. removing the code that manually adds - the system scope dependencies make the test fail). - - public void testSystemDependencyFound() - throws Exception - { - File pom = new File( getBasedir(), "src/test/projects/project11/pom.xml" ); - - String output = execute( pom, "java" ); - - assertEquals( FindClassInClasspath.FOUND_ALL, output.trim() ); - } - */ + * This test doesn't work because the sun.tools.javac.Main class referenced in the project pom is found even if the + * system scope dependencies are not added by the plugin. The class was probably loaded by another plugin ?! To fix + * the test we have to: - maybe use a different system scope dependency/class to load. - find a different way to + * test. When ran manually, the test works though (i.e. removing the code that manually adds the system scope + * dependencies make the test fail). public void testSystemDependencyFound() throws Exception { File pom = new File( + * getBasedir(), "src/test/projects/project11/pom.xml" ); String output = execute( pom, "java" ); assertEquals( + * FindClassInClasspath.FOUND_ALL, output.trim() ); } + */ /** * Test the commandline parsing facilities of the {@link AbstractExecMojo} class + * @throws Exception if any exception occurs */ - public void testRunWithArgs() throws Exception + public void testRunWithArgs() + throws Exception { String resultString = execute( new File( getBasedir(), "src/test/projects/project8/pom.xml" ), "java" ); - String LS = System.getProperty("line.separator"); - String expectedResult = "Hello" + LS + "Arg1" + LS +"Arg2a Arg2b" + LS; + String LS = System.getProperty( "line.separator" ); + String expectedResult = "Hello" + LS + "Arg1" + LS + "Arg2a Arg2b" + LS; assertEquals( expectedResult, resultString ); } /** * @return output from System.out during mojo execution */ - private String execute( File pom, String goal ) throws Exception { + private String execute( File pom, String goal ) + throws Exception + { ExecJavaMojo mojo; mojo = (ExecJavaMojo) lookupMojo( goal, pom ); @@ -222,9 +244,9 @@ MavenProject project = (MavenProject) getVariableValueFromObject( mojo, "project" ); - // why isn't this set up by the harness based on the default-value? TODO get to bottom of this! + // why isn't this set up by the harness based on the default-value? TODO get to bottom of this! setVariableValueToObject( mojo, "includeProjectDependencies", Boolean.TRUE ); - setVariableValueToObject( mojo, "killAfter", new Long( -1 ) ); + setVariableValueToObject( mojo, "killAfter", (long) -1 ); setVariableValueToObject( mojo, "cleanupDaemonThreads", Boolean.TRUE ); setVariableValueToObject( mojo, "classpathScope", "compile" ); @@ -245,7 +267,7 @@ finally { // see testUncooperativeThread() for explaination - Thread.sleep( 150 ); // time seems about right + Thread.sleep( 300 ); // time seems about right System.setOut( out ); } @@ -262,8 +284,9 @@ String path = "src/test/repository"; - ArtifactRepository localRepository = new DefaultArtifactRepository( "local", "file://" + - new File( path ).getAbsolutePath(), localRepositoryLayout ); + ArtifactRepository localRepository = + new DefaultArtifactRepository( "local", "file://" + new File( path ).getAbsolutePath(), + localRepositoryLayout ); MavenProject project = builder.buildWithDependencies( pomFile, localRepository, null ); // this gets the classes for these tests of this mojo (exec plugin) onto the project classpath for the test diff -Nru exec-maven-plugin-1.1.1+dfsg/src/test/java/org/codehaus/mojo/exec/ExecMojoTest.java exec-maven-plugin-1.6.0/src/test/java/org/codehaus/mojo/exec/ExecMojoTest.java --- exec-maven-plugin-1.1.1+dfsg/src/test/java/org/codehaus/mojo/exec/ExecMojoTest.java 2009-11-26 14:32:09.000000000 +0000 +++ exec-maven-plugin-1.6.0/src/test/java/org/codehaus/mojo/exec/ExecMojoTest.java 2017-03-02 20:58:24.000000000 +0000 @@ -1,55 +1,55 @@ package org.codehaus.mojo.exec; /* - * Copyright 2005 The Codehaus. - * - * 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. + * Copyright 2005 The Codehaus. 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. */ -import org.apache.maven.artifact.repository.ArtifactRepository; -import org.apache.maven.artifact.repository.DefaultArtifactRepository; -import org.apache.maven.artifact.repository.layout.ArtifactRepositoryLayout; -import org.apache.maven.plugin.MojoExecutionException; -import org.apache.maven.plugin.logging.SystemStreamLog; -import org.apache.maven.project.MavenProject; -import org.apache.maven.project.MavenProjectBuilder; -import org.codehaus.plexus.util.cli.CommandLineException; -import org.codehaus.plexus.util.cli.Commandline; -import org.codehaus.plexus.util.cli.StreamConsumer; - -import java.io.BufferedReader; import java.io.File; -import java.io.FileReader; import java.io.IOException; +import java.io.OutputStream; import java.io.PrintStream; -import org.codehaus.plexus.util.StringOutputStream; import java.util.ArrayList; import java.util.Arrays; import java.util.HashMap; import java.util.List; import java.util.Map; -import org.codehaus.plexus.logging.Logger; -import org.codehaus.plexus.logging.console.ConsoleLogger; +import java.util.UUID; + +import org.apache.commons.exec.CommandLine; +import org.apache.commons.exec.ExecuteException; +import org.apache.commons.exec.Executor; +import org.apache.commons.exec.OS; +import org.apache.maven.artifact.repository.ArtifactRepository; +import org.apache.maven.artifact.repository.DefaultArtifactRepository; +import org.apache.maven.artifact.repository.layout.ArtifactRepositoryLayout; import org.apache.maven.monitor.logging.DefaultLog; +import org.apache.maven.plugin.MojoExecutionException; +import org.apache.maven.plugin.logging.SystemStreamLog; import org.apache.maven.plugin.testing.AbstractMojoTestCase; +import org.apache.maven.project.MavenProject; +import org.apache.maven.project.MavenProjectBuilder; +import org.codehaus.plexus.logging.Logger; +import org.codehaus.plexus.logging.console.ConsoleLogger; +import org.codehaus.plexus.util.StringOutputStream; /** - * @author Jerome Lacoste - * @version $Id: ExecMojoTest.java 8882 2009-01-22 20:47:34Z lacostej $ + * @author Jerome Lacoste + * @version $Id$ */ public class ExecMojoTest extends AbstractMojoTestCase { + /* + * Finding a file actually on disk of the test system makes some of the tests fail. + * Hence a purely random UUID is used to prevent this situation. + */ + private static final String SOME_EXECUTABLE = UUID.randomUUID().toString(); + private MockExecMojo mojo; static class MockExecMojo @@ -57,34 +57,37 @@ { public int executeResult; - public List commandLines = new ArrayList(); + public List commandLines = new ArrayList(); public String failureMsg; - public Map systemProperties = new HashMap(); + public Map systemProperties = new HashMap(); - protected int executeCommandLine( Commandline commandLine, StreamConsumer stream1, StreamConsumer stream2 ) - throws CommandLineException + protected int executeCommandLine( Executor exec, CommandLine commandLine, Map enviro, OutputStream out, + OutputStream err ) + throws IOException, ExecuteException { commandLines.add( commandLine ); if ( failureMsg != null ) { - throw new CommandLineException( failureMsg ); + throw new ExecuteException( failureMsg, executeResult ); } return executeResult; } protected String getSystemProperty( String key ) { - return (String) systemProperties.get( key ); + return systemProperties.get( key ); } - int getAmountExecutedCommandLines() { + int getAmountExecutedCommandLines() + { return commandLines.size(); } - Commandline getExecutedCommandline( int index ) { - return ((Commandline) commandLines.get( index )); + CommandLine getExecutedCommandline( int index ) + { + return commandLines.get( index ); } } @@ -93,108 +96,101 @@ { super.setUp(); mojo = new MockExecMojo(); - // note: most of the tests below assume that the specified + // note: most of the tests below assume that the specified // executable path is not fully specicied. See ExecMojo#getExecutablePath - mojo.setExecutable( "mvn" ); - mojo.setArguments( Arrays.asList( new String[]{"--version"} ) ); + mojo.setExecutable( SOME_EXECUTABLE ); + mojo.setArguments( Arrays.asList( new String[] { "--version" } ) ); mojo.executeResult = 0; mojo.setBasedir( File.createTempFile( "mvn-temp", "txt" ).getParentFile() ); } - /** - */ public void testRunOK() throws MojoExecutionException { mojo.execute(); - checkMojo( "mvn --version" ); + checkMojo( SOME_EXECUTABLE + " --version" ); } /* - This one won't work yet - public void xxtestSimpleRunPropertiesAndArguments() - throws MojoExecutionException, Exception - { - File pom = new File( getBasedir(), "src/test/projects/project1/pom.xml" ); - - String output = execute( pom, "exec" ); - - System.out.println(" OUTPUT" + output + "\n\n\n"); - - String expectedOutput = "arg.arg1\narg.arg2\nproject.env1=value1"; // FIXME should work on Windows as well - - assertEquals( expectedOutput, output ); - } - */ + * This one won't work yet public void xxtestSimpleRunPropertiesAndArguments() throws MojoExecutionException, + * Exception { File pom = new File( getBasedir(), "src/test/projects/project1/pom.xml" ); String output = execute( + * pom, "exec" ); System.out.println(" OUTPUT" + output + "\n\n\n"); String expectedOutput = + * "arg.arg1\narg.arg2\nproject.env1=value1"; // FIXME should work on Windows as well assertEquals( expectedOutput, + * output ); } + */ /** - * integration test... - * - compile the Test class using mvn clean compile - * - run the test file using java, use it to generate a file whose contains are compared to expected output + * integration test... - compile the Test class using mvn clean compile - run the test file using java, use it to + * generate a file whose contains are compared to expected output */ -/* - public void testRunOKWithAutoComputedClasspath() - throws MojoExecutionException, Exception - { - String projectName = "project1"; - - ExecMojo mojo = new ExecMojo(); - - setUpProject( projectName, mojo ); - - // compile project - mojo.setExecutable( "mvn" ); - mojo.setWorkingDirectory( new File( "src/test/projects/" + projectName + "/" ) ); - mojo.setArguments( Arrays.asList( new String[]{"clean", "compile"} ) ); - - mojo.execute(); - - mojo.getLog().info( "executed mvn clean compile" ); - - // the command executes the test class - mojo.setExecutable( "java" ); - mojo.setWorkingDirectory( (File) null ); - Classpath classpath = new Classpath(); - mojo.setArguments( Arrays.asList( new Object[]{"-Dproject.env1=value1", "-classpath", classpath, - "org.codehaus.mojo.exec.test.Test", - new File( "src/test/projects/" + projectName + "/target/exec/output.txt" ).getAbsolutePath(), "arg1", - "arg2"} ) ); - - mojo.execute(); - - // checking the command line would involve resolving the repository - // checkMojo( "java -cp" ); - - assertFileEquals( null, getTestFile( "src/test/projects/" + projectName + "/output.txt" ), - getTestFile( "src/test/projects/" + projectName + "/target/exec/output.txt" ) ); - - // the command executes the test class, this time specifying the dependencies - mojo.setExecutable( "java" ); - mojo.setWorkingDirectory( (File) null ); - classpath = new Classpath(); - List dependencies = new ArrayList(); - dependencies.add( "commons-io:commons-io" ); - classpath.setDependencies( dependencies ); - mojo.setArguments( Arrays.asList( new Object[]{"-Dproject.env1=value1", "-classpath", classpath, - "org.codehaus.mojo.exec.test.Test", - new File( "src/test/projects/" + projectName + "/target/exec/output.txt" ).getAbsolutePath(), "arg1", - "arg2"} ) ); - - mojo.execute(); - // checking the command line would involve resolving the repository - // checkMojo( "java -cp" ); - - assertFileEquals( null, getTestFile( "src/test/projects/" + projectName + "/output.txt" ), - getTestFile( "src/test/projects/" + projectName + "/target/exec/output.txt" ) ); - } -*/ + // public void testRunOKWithAutoComputedClasspath() + // throws MojoExecutionException, Exception + // { + // String projectName = "project1"; + // + // ExecMojo mojo = new ExecMojo(); + // + // setUpProject( projectName, mojo ); + // + // // compile project + // mojo.setExecutable( SOME_EXECUTABLE ); + // mojo.setWorkingDirectory( new File( "src/test/projects/" + projectName + "/" ) ); + // mojo.setArguments( Arrays.asList( new String[]{"clean", "compile"} ) ); + // + // mojo.execute(); + // + // mojo.getLog().info( "executed mvn clean compile" ); + // + // // the command executes the test class + // mojo.setExecutable( "java" ); + // mojo.setWorkingDirectory( (File) null ); + // Classpath classpath = new Classpath(); + // mojo.setArguments( Arrays.asList( new Object[]{"-Dproject.env1=value1", "-classpath", classpath, + // "org.codehaus.mojo.exec.test.Test", + // new File( "src/test/projects/" + projectName + "/target/exec/output.txt" ).getAbsolutePath(), "arg1", + // "arg2"} ) ); + // + // mojo.execute(); + // + // // checking the command line would involve resolving the repository + // // checkMojo( "java -cp" ); + // + // assertFileEquals( null, getTestFile( "src/test/projects/" + projectName + "/output.txt" ), + // getTestFile( "src/test/projects/" + projectName + "/target/exec/output.txt" ) ); + // + // // the command executes the test class, this time specifying the dependencies + // mojo.setExecutable( "java" ); + // mojo.setWorkingDirectory( (File) null ); + // classpath = new Classpath(); + // List dependencies = new ArrayList(); + // dependencies.add( "commons-io:commons-io" ); + // classpath.setDependencies( dependencies ); + // mojo.setArguments( Arrays.asList( new Object[]{"-Dproject.env1=value1", "-classpath", classpath, + // "org.codehaus.mojo.exec.test.Test", + // new File( "src/test/projects/" + projectName + "/target/exec/output.txt" ).getAbsolutePath(), "arg1", + // "arg2"} ) ); + // + // mojo.execute(); + // + // // checking the command line would involve resolving the repository + // // checkMojo( "java -cp" ); + // + // assertFileEquals( null, getTestFile( "src/test/projects/" + projectName + "/output.txt" ), + // getTestFile( "src/test/projects/" + projectName + "/target/exec/output.txt" ) ); + // } /** + * + * @param pom the pom file + * @param goal the goal to execute * @return output from System.out during mojo execution + * @throws Exception if any exception occurs */ - private String execute( File pom, String goal ) throws Exception { + protected String execute( File pom, String goal ) + throws Exception + { ExecMojo mojo; mojo = (ExecMojo) lookupMojo( goal, pom ); @@ -203,7 +199,7 @@ MavenProject project = (MavenProject) getVariableValueFromObject( mojo, "project" ); - // why isn't this set up by the harness based on the default-value? TODO get to bottom of this! + // why isn't this set up by the harness based on the default-value? TODO get to bottom of this! // setVariableValueToObject( mojo, "includeProjectDependencies", Boolean.TRUE ); // setVariableValueToObject( mojo, "killAfter", new Long( -1 ) ); @@ -234,7 +230,6 @@ return stringOutputStream.toString(); } - private void setUpProject( File pomFile, ExecMojo mojo ) throws Exception { @@ -245,8 +240,9 @@ String path = "src/test/repository"; - ArtifactRepository localRepository = new DefaultArtifactRepository( "local", "file://" + - new File( path ).getAbsolutePath(), localRepositoryLayout ); + ArtifactRepository localRepository = + new DefaultArtifactRepository( "local", "file://" + new File( path ).getAbsolutePath(), + localRepositoryLayout ); mojo.setBasedir( File.createTempFile( "mvn-temp", "txt" ).getParentFile() ); @@ -266,25 +262,90 @@ } ); } - // MEXEC-12 - public void testGetExecutablePath() throws IOException + // MEXEC-12, MEXEC-72 + public void testGetExecutablePath() + throws IOException { + ExecMojo realMojo = new ExecMojo(); - String myJavaPath = "target" + File.separator + "java"; + File workdir = new File( System.getProperty( "user.dir" ) ); + Map enviro = new HashMap(); + + String myJavaPath = "target" + File.separator + "javax"; File f = new File( myJavaPath ); - assertTrue( "file created...", f.createNewFile() ); - assertTrue( "file exists...", f.exists() ); + assertTrue( "file created...", f.createNewFile() ); + assertTrue( "file exists...", f.exists() ); realMojo.setExecutable( myJavaPath ); + CommandLine cmd = realMojo.getExecutablePath( enviro, workdir ); assertTrue( "File exists so path is absolute", - realMojo.getExecutablePath().startsWith( System.getProperty( "user.dir" ) ) ); + cmd.getExecutable().startsWith( System.getProperty( "user.dir" ) ) ); f.delete(); - assertFalse( "file deleted...", f.exists() ); - assertEquals( "File doesn't exist. Let the system find it (in that PATH?)", - myJavaPath, realMojo.getExecutablePath() ); + assertFalse( "file deleted...", f.exists() ); + cmd = realMojo.getExecutablePath( enviro, workdir ); + assertEquals( "File doesn't exist. Let the system find it (in that PATH?)", myJavaPath, cmd.getExecutable() ); + + if ( OS.isFamilyWindows() ) // Exec Maven Plugin only supports Batch detection and PATH search on Windows + { + myJavaPath = "target" + File.separator + "javax.bat"; + f = new File( myJavaPath ); + assertTrue( "file created...", f.createNewFile() ); + assertTrue( "file exists...", f.exists() ); + + final String comSpec = System.getenv( "ComSpec" ); + + realMojo.setExecutable( "javax.bat" ); + cmd = realMojo.getExecutablePath( enviro, workdir ); + assertTrue( "is bat file on windows, execute using ComSpec.", cmd.getExecutable().equals( comSpec ) ); + + enviro.put( "PATH", workdir.getAbsolutePath() + File.separator + "target" ); + cmd = realMojo.getExecutablePath( enviro, workdir ); + assertTrue( "is bat file on windows' PATH, execute using ComSpec.", cmd.getExecutable().equals( comSpec ) ); + f.delete(); + assertFalse( "file deleted...", f.exists() ); + } + } + + // under Windows cmd/bat files should be preferred over files with the same prefix without extension, e.g. + // if there are "node" and "node.cmd" the mojo should pick "node.cmd" + // see https://github.com/mojohaus/exec-maven-plugin/issues/42 + public void testGetExecutablePathPreferExecutableExtensionsOnWindows() + throws IOException + { + // this test is for Windows + if (!OS.isFamilyWindows()) { + return; + } + final ExecMojo realMojo = new ExecMojo(); + + final String tmp = System.getProperty("java.io.tmpdir"); + final File workdir = new File(tmp, "testGetExecutablePathPreferExecutableExtensionsOnWindows"); + workdir.mkdirs(); + + final Map enviro = new HashMap(); + + final File f = new File(workdir, "mycmd"); + final File fCmd = new File(workdir, "mycmd.cmd"); + f.createNewFile(); + fCmd.createNewFile(); + assertTrue( "file exists...", f.exists() ); + assertTrue( "file exists...", fCmd.exists() ); + + realMojo.setExecutable( "mycmd" ); + + final CommandLine cmd = realMojo.getExecutablePath( enviro, workdir ); + // cmdline argumets are: [/c, %path-to-temp%\mycmd.cmd], so check second argument + assertTrue( "File should have cmd extension", + cmd.getArguments()[1].endsWith( "mycmd.cmd" ) ); + + f.delete(); + fCmd.delete(); + assertFalse( "file deleted...", f.exists() ); + assertFalse( "file deleted...", fCmd.exists() ); + } public void testRunFailure() @@ -298,11 +359,10 @@ } catch ( MojoExecutionException e ) { - assertEquals( "Result of " + mojo.getExecutedCommandline( 0 ) + " execution is: '1'.", - e.getMessage() ); + assertEquals( "Result of " + mojo.getExecutedCommandline( 0 ) + " execution is: '1'.", e.getMessage() ); } - checkMojo( "mvn --version" ); + checkMojo( SOME_EXECUTABLE + " --version" ); } public void testRunError() @@ -319,7 +379,7 @@ assertEquals( "Command execution failed.", e.getMessage() ); } - checkMojo( "mvn --version" ); + checkMojo( SOME_EXECUTABLE + " --version" ); } public void testOverrides() @@ -328,7 +388,7 @@ mojo.systemProperties.put( "exec.args", "-f pom.xml" ); mojo.execute(); - checkMojo( "mvn -f pom.xml" ); + checkMojo( SOME_EXECUTABLE + " -f pom.xml" ); } public void testOverrides3() @@ -337,110 +397,78 @@ mojo.systemProperties.put( "exec.args", null ); mojo.execute(); - checkMojo( "mvn --version" ); + checkMojo( SOME_EXECUTABLE + " --version" ); mojo.commandLines.clear(); mojo.systemProperties.put( "exec.args", "" ); mojo.execute(); - checkMojo( "mvn --version" ); + checkMojo( SOME_EXECUTABLE + " --version" ); } - public void testIsResultCodeAFailure() + public void testIsResultCodeAFailure() { ExecMojo execMojo = new ExecMojo(); - assertTrue(execMojo.isResultCodeAFailure(1)); - assertFalse(execMojo.isResultCodeAFailure(0)); + assertTrue( execMojo.isResultCodeAFailure( 1 ) ); + assertFalse( execMojo.isResultCodeAFailure( 0 ) ); - execMojo.setSuccessCodes(new ArrayList()); - assertTrue(execMojo.isResultCodeAFailure(1)); - assertFalse(execMojo.isResultCodeAFailure(0)); - - execMojo.setSuccessCodes(Arrays.asList(new String[] { "2", "5" })); - assertTrue(execMojo.isResultCodeAFailure(0)); - assertTrue(execMojo.isResultCodeAFailure(10)); - assertFalse(execMojo.isResultCodeAFailure(2)); - assertFalse(execMojo.isResultCodeAFailure(5)); + execMojo.setSuccessCodes( new Integer[0] ); + assertTrue( execMojo.isResultCodeAFailure( 1 ) ); + assertFalse( execMojo.isResultCodeAFailure( 0 ) ); + + execMojo.setSuccessCodes( new Integer[] { Integer.valueOf( "2" ), Integer.valueOf( "5" ) } ); + assertTrue( execMojo.isResultCodeAFailure( 0 ) ); + assertTrue( execMojo.isResultCodeAFailure( 10 ) ); + assertFalse( execMojo.isResultCodeAFailure( 2 ) ); + assertFalse( execMojo.isResultCodeAFailure( 5 ) ); } - + + // MEXEC-81 + public void testParseCommandlineOSWin() + throws Exception + { + ExecMojo execMojo = new ExecMojo(); + final String javaHome = "C:\\Java\\jdk1.5.0_15"; + // can only be set by expression or plugin-configuration + setVariableValueToObject( execMojo, "commandlineArgs", javaHome ); + String[] args = execMojo.parseCommandlineArgs(); + assertEquals( javaHome, args[0] ); + } + private void checkMojo( String expectedCommandLine ) { assertEquals( 1, mojo.getAmountExecutedCommandLines() ); - Commandline commandline = mojo.getExecutedCommandline( 0 ); + CommandLine commandline = mojo.getExecutedCommandline( 0 ); // do NOT depend on Commandline toString() - assertEquals(expectedCommandLine, getCommandLineAsString( commandline )); + assertEquals( expectedCommandLine, getCommandLineAsString( commandline ) ); } - private String getCommandLineAsString( Commandline commandline ) { + private String getCommandLineAsString( CommandLine commandline ) + { + // for the sake of the test comparisons, cut out the eventual + // cmd /c *.bat conversion String result = commandline.getExecutable(); - String[] arguments = commandline.getArguments(); - for (int i = 0; i < arguments.length; i++) + boolean isCmd = false; + if ( OS.isFamilyWindows() && result.equals( "cmd" ) ) { - String arg = arguments[i]; - result += " " + arg; + result = ""; + isCmd = true; } - return result; - } - - // TAKEN FROM NetbeansFreeformPluginTest - refactor ? - - /** - * This method asserts that the two given files are equals in their - * content. - * - * @param mavenRepo Not used. - * @param expectedFile The file that is expected. - * @param actualFile The file that is. - * @throws java.io.IOException if something goes wrong. - */ - private void assertFileEquals( String mavenRepo, File expectedFile, File actualFile ) - throws IOException - { - List expectedLines = getLines( mavenRepo, expectedFile ); - - List actualLines = getLines( mavenRepo, actualFile ); - - for ( int i = 0; i < expectedLines.size(); i++ ) + String[] arguments = commandline.getArguments(); + for ( int i = 0; i < arguments.length; i++ ) { - String expected = expectedLines.get( i ).toString(); - - if ( actualLines.size() < i ) + String arg = arguments[i]; + if ( isCmd && i == 0 && "/c".equals( arg ) ) { - fail( "Too few lines in the actual file. Was " + actualLines.size() + ", expected: " + - expectedLines.size() ); + continue; } - - String actual = actualLines.get( i ).toString(); - - assertEquals( "Checking line #" + ( i + 1 ), expected, actual ); + if ( isCmd && i == 1 && arg.endsWith( ".bat" ) ) + { + arg = arg.substring( 0, arg.length() - ".bat".length() ); + } + result += ( result.length() == 0 ? "" : " " ) + arg; } - - assertTrue( "Unequal number of lines.", expectedLines.size() == actualLines.size() ); + return result; } - /** - * This method gives the list of String in a file. - * - * @param mavenRepo Not used. - * @param file The file to be read. - * @return The list of the lines of the file. - * @throws java.io.IOException if something goes wrong. - */ - private List getLines( String mavenRepo, File file ) - throws IOException - { - List lines = new ArrayList(); - - BufferedReader reader = new BufferedReader( new FileReader( file ) ); - - String line; - - while ( ( line = reader.readLine() ) != null ) - { - lines.add( - line ); //StringUtils.replace( line, "#ArtifactRepositoryPath#", mavenRepo.replace( '\\', '/' ) ) ); - } - - return lines; - } } diff -Nru exec-maven-plugin-1.1.1+dfsg/src/test/java/org/codehaus/mojo/exec/FindClassInClasspath.java exec-maven-plugin-1.6.0/src/test/java/org/codehaus/mojo/exec/FindClassInClasspath.java --- exec-maven-plugin-1.1.1+dfsg/src/test/java/org/codehaus/mojo/exec/FindClassInClasspath.java 2009-11-26 14:32:09.000000000 +0000 +++ exec-maven-plugin-1.6.0/src/test/java/org/codehaus/mojo/exec/FindClassInClasspath.java 2017-03-02 20:58:24.000000000 +0000 @@ -1,8 +1,5 @@ package org.codehaus.mojo.exec; -import java.util.Timer; -import java.util.TimerTask; - /** * @author Jerome Lacoste */ @@ -11,32 +8,32 @@ public static final String FOUND_ALL = "OK"; /** - * @param args the names of classes to search in the classpath - * prints 'OK' if all classes found + * @param args the names of classes to search in the classpath prints 'OK' if all classes found **/ - public static void main( String[] args ) + public static void main( String... args ) { - for (int i = 0; i < args.length; i++) - { - if ( ! isClassInClasspath( args[i] )) + for ( String arg : args ) { - System.out.println( "ERROR: class + " + args[i] + " not found in classpath" ); - System.exit( 1 ); + if ( !isClassInClasspath( arg ) ) + { + System.out.println( "ERROR: class + " + arg + " not found in classpath" ); + System.exit( 1 ); + } } - } - System.out.println( FOUND_ALL ); + System.out.println( FOUND_ALL ); } private static boolean isClassInClasspath( String className ) { - try - { - Class.forName( className ); - return true; - } catch ( Exception e ) - { - System.out.println( "ERROR: " + e.getMessage() ); - return false; - } + try + { + Class.forName( className ); + return true; + } + catch ( Exception e ) + { + System.out.println( "ERROR: " + e.getMessage() ); + return false; + } } } diff -Nru exec-maven-plugin-1.1.1+dfsg/src/test/java/org/codehaus/mojo/exec/MainUncooperative.java exec-maven-plugin-1.6.0/src/test/java/org/codehaus/mojo/exec/MainUncooperative.java --- exec-maven-plugin-1.1.1+dfsg/src/test/java/org/codehaus/mojo/exec/MainUncooperative.java 2009-11-26 14:32:09.000000000 +0000 +++ exec-maven-plugin-1.6.0/src/test/java/org/codehaus/mojo/exec/MainUncooperative.java 2017-03-02 20:58:24.000000000 +0000 @@ -1,61 +1,59 @@ package org.codehaus.mojo.exec; /** - * Created by IntelliJ IDEA. - * User: dsmiley - * Date: Jan 19, 2007 - * Time: 4:43:19 PM - * To change this template use File | Settings | File Templates. + * Created by IntelliJ IDEA. User: dsmiley Date: Jan 19, 2007 Time: 4:43:19 PM To change this template use File | + * Settings | File Templates. */ -public class MainUncooperative extends Thread +public class MainUncooperative + extends Thread { public static final String SUCCESS = "1(interrupted)(f)2(f)"; - public static void main( String[] args ) + public static void main( String... args ) throws InterruptedException { Thread daemonThread = new MainUncooperative(); daemonThread.setDaemon( true ); daemonThread.start(); Thread.sleep( 1000 ); - //returns to caller now + // returns to caller now } - final long SIMWORKTIME = 15*1000;//15 seconds of work which is going to be more than exec:java wants to wait + final long SIMWORKTIME = 15 * 1000;// 15 seconds of work which is going to be more than exec:java wants to wait public void run() { boolean interruptedOnce = false; long startedTime = System.currentTimeMillis(); - for(int lap = 1; true; lap++ ) + for ( int lap = 1; true; lap++ ) { - long remainingWork = SIMWORKTIME - (System.currentTimeMillis() - startedTime); + long remainingWork = SIMWORKTIME - ( System.currentTimeMillis() - startedTime ); if ( remainingWork <= 0 ) { - break;//done + break;// done } try { System.out.print( lap ); - Thread.sleep(remainingWork);//simulates doing work + Thread.sleep( remainingWork );// simulates doing work System.out.print( "(done)" ); break; } catch ( InterruptedException e ) { - //We want to ensure this only gets reported once. It's possible depending on a race condition for + // We want to ensure this only gets reported once. It's possible depending on a race condition for // ExecJavaMojo.terminateThreads() to interrupt this thread a second time. - if ( ! interruptedOnce ) + if ( !interruptedOnce ) { System.out.print( "(interrupted)" ); } interruptedOnce = true; - //be uncooperative; don't quit and don't set interrupted status + // be uncooperative; don't quit and don't set interrupted status } finally { - System.out.print("(f)");//we should see this if Thread.stop() is called + System.out.print( "(f)" );// we should see this if Thread.stop() is called } } } diff -Nru exec-maven-plugin-1.1.1+dfsg/src/test/java/org/codehaus/mojo/exec/MainWithThreads.java exec-maven-plugin-1.6.0/src/test/java/org/codehaus/mojo/exec/MainWithThreads.java --- exec-maven-plugin-1.1.1+dfsg/src/test/java/org/codehaus/mojo/exec/MainWithThreads.java 2009-11-26 14:32:09.000000000 +0000 +++ exec-maven-plugin-1.6.0/src/test/java/org/codehaus/mojo/exec/MainWithThreads.java 2017-03-02 20:58:24.000000000 +0000 @@ -6,19 +6,22 @@ /** * @author David Smiley */ -public class MainWithThreads extends Thread +public class MainWithThreads + extends Thread { public static final String ALL_EXITED = "t1(interrupted td)(cancelled timer)"; + public static final String TIMER_IGNORED = "t1(interrupted td)"; - /** - * both daemon threads will be interrupted as soon as the non daemon thread is done. - * the responsive daemon thread will be interrupted right away. - * - if the timer is cancelled (using 'cancelTimer' as argument), the timer will die on itself - * after all the other threads - * - if not, one must use a time out to stop joining on that unresponsive daemon thread + /** + * both daemon threads will be interrupted as soon as the non daemon thread is done. the responsive daemon thread + * will be interrupted right away. - if the timer is cancelled (using 'cancelTimer' as argument), the timer will die + * on itself after all the other threads - if not, one must use a time out to stop joining on that unresponsive + * daemon thread + * + * @param args the arguments **/ - public static void main( String[] args ) + public static void main( String... args ) { // long run so that we interrupt it before it ends itself Thread responsiveDaemonThread = new MainWithThreads( 60000, "td" ); @@ -45,15 +48,18 @@ private static boolean optionsContains( String[] args, String option ) { - for (int i = 0; i < args.length; i++ ) + for ( String arg : args ) { - if ( args[i].equals( option ) ) + if ( arg.equals( option ) ) + { return true; + } } return false; } private int millisecsToSleep; + private String message; public MainWithThreads( int millisecsToSleep, String message ) diff -Nru exec-maven-plugin-1.1.1+dfsg/src/test/java/org/codehaus/mojo/exec/NoMain.java exec-maven-plugin-1.6.0/src/test/java/org/codehaus/mojo/exec/NoMain.java --- exec-maven-plugin-1.1.1+dfsg/src/test/java/org/codehaus/mojo/exec/NoMain.java 2009-11-26 14:32:09.000000000 +0000 +++ exec-maven-plugin-1.6.0/src/test/java/org/codehaus/mojo/exec/NoMain.java 2017-03-02 20:58:24.000000000 +0000 @@ -16,15 +16,16 @@ * limitations under the License. */ - /** - * @author Jerome Lacoste - * @version $Id: NoMain.java 6588 2008-03-28 12:22:57Z bentmann $ + * @author Jerome Lacoste + * @version $Id$ */ public class NoMain { // MEXEC-29 wrong interface for main method causes NPE - public static void main( ) throws Exception { - + public static void main() + throws Exception + { + } } diff -Nru exec-maven-plugin-1.1.1+dfsg/src/test/java/org/codehaus/mojo/exec/ThrowingMain.java exec-maven-plugin-1.6.0/src/test/java/org/codehaus/mojo/exec/ThrowingMain.java --- exec-maven-plugin-1.1.1+dfsg/src/test/java/org/codehaus/mojo/exec/ThrowingMain.java 1970-01-01 00:00:00.000000000 +0000 +++ exec-maven-plugin-1.6.0/src/test/java/org/codehaus/mojo/exec/ThrowingMain.java 2017-03-02 20:58:24.000000000 +0000 @@ -0,0 +1,34 @@ +/** + * Copyright 2016 Google Inc. + * + * 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 org.codehaus.mojo.exec; + +import java.io.IOException; + +/** + * Executable used to test applications which exit exceptionally. + * + * @author Lukasz Cwik + */ +public class ThrowingMain +{ + public static void main( String... args ) + throws Exception + { + throw new IOException( "expected IOException thrown by test" ); + } +} + diff -Nru exec-maven-plugin-1.1.1+dfsg/src/test/java/org/codehaus/plexus/util/interpolation/Interpolator.java exec-maven-plugin-1.6.0/src/test/java/org/codehaus/plexus/util/interpolation/Interpolator.java --- exec-maven-plugin-1.1.1+dfsg/src/test/java/org/codehaus/plexus/util/interpolation/Interpolator.java 1970-01-01 00:00:00.000000000 +0000 +++ exec-maven-plugin-1.6.0/src/test/java/org/codehaus/plexus/util/interpolation/Interpolator.java 2017-03-02 20:58:24.000000000 +0000 @@ -0,0 +1,14 @@ +package org.codehaus.plexus.util.interpolation; + +/** + * COPIED FROM plexus-utils-1.5.15 TO SATISFY TESTS Interpolator interface. Based on existing RegexBasedInterpolator + * interface. + * + * @author cstamas + * @deprecated Use plexus-interpolation APIs instead. + * @version $Id$ + */ +public interface Interpolator + extends org.codehaus.plexus.interpolation.Interpolator +{ +} diff -Nru exec-maven-plugin-1.1.1+dfsg/src/test/java/org/codehaus/plexus/util/interpolation/RegexBasedInterpolator.java exec-maven-plugin-1.6.0/src/test/java/org/codehaus/plexus/util/interpolation/RegexBasedInterpolator.java --- exec-maven-plugin-1.1.1+dfsg/src/test/java/org/codehaus/plexus/util/interpolation/RegexBasedInterpolator.java 1970-01-01 00:00:00.000000000 +0000 +++ exec-maven-plugin-1.6.0/src/test/java/org/codehaus/plexus/util/interpolation/RegexBasedInterpolator.java 2017-03-02 20:58:24.000000000 +0000 @@ -0,0 +1,44 @@ +package org.codehaus.plexus.util.interpolation; + +import java.util.List; + +/** + * COPIED FROM plexus-utils-1.5.15 TO SATISFY TESTS + * + * @version $Id$ + * @deprecated Use plexus-interpolation APIs instead. + */ +public class RegexBasedInterpolator + extends org.codehaus.plexus.interpolation.RegexBasedInterpolator + implements Interpolator +{ + public RegexBasedInterpolator() + { + super(); + } + + public RegexBasedInterpolator( List valueSources ) + { + super( valueSources ); + } + + public RegexBasedInterpolator( String startRegex, String endRegex, List valueSources ) + { + super( startRegex, endRegex, valueSources ); + } + + public RegexBasedInterpolator( String startRegex, String endRegex ) + { + super( startRegex, endRegex ); + } + + public void addValueSource( ValueSource valueSource ) + { + super.addValueSource( valueSource ); + } + + public void removeValuesSource( ValueSource valueSource ) + { + super.removeValuesSource( valueSource ); + } +} diff -Nru exec-maven-plugin-1.1.1+dfsg/src/test/java/org/codehaus/plexus/util/interpolation/ValueSource.java exec-maven-plugin-1.6.0/src/test/java/org/codehaus/plexus/util/interpolation/ValueSource.java --- exec-maven-plugin-1.1.1+dfsg/src/test/java/org/codehaus/plexus/util/interpolation/ValueSource.java 1970-01-01 00:00:00.000000000 +0000 +++ exec-maven-plugin-1.6.0/src/test/java/org/codehaus/plexus/util/interpolation/ValueSource.java 2017-03-02 20:58:24.000000000 +0000 @@ -0,0 +1,14 @@ +package org.codehaus.plexus.util.interpolation; + +/** + * COPIED FROM plexus-utils-1.5.15 TO SATISFY TESTS + * + * @author jdcasey + * @deprecated Use plexus-interpolation APIs instead. + * @version $Id$ + */ +public interface ValueSource + extends org.codehaus.plexus.interpolation.ValueSource +{ + +} diff -Nru exec-maven-plugin-1.1.1+dfsg/src/test/projects/project1/src/main/java/org/codehaus/mojo/exec/test1/Test.java exec-maven-plugin-1.6.0/src/test/projects/project1/src/main/java/org/codehaus/mojo/exec/test1/Test.java --- exec-maven-plugin-1.1.1+dfsg/src/test/projects/project1/src/main/java/org/codehaus/mojo/exec/test1/Test.java 2009-11-26 14:32:09.000000000 +0000 +++ exec-maven-plugin-1.6.0/src/test/projects/project1/src/main/java/org/codehaus/mojo/exec/test1/Test.java 2017-03-02 20:58:24.000000000 +0000 @@ -29,7 +29,7 @@ /** * @author Jerome Lacoste - * @version $Id: Test.java 6588 2008-03-28 12:22:57Z bentmann $ + * @version $Id$ * @todo we depend too much on Commandline.toString() */ public class Test diff -Nru exec-maven-plugin-1.1.1+dfsg/src/test/projects/project12/pom.xml exec-maven-plugin-1.6.0/src/test/projects/project12/pom.xml --- exec-maven-plugin-1.1.1+dfsg/src/test/projects/project12/pom.xml 2009-11-26 14:32:10.000000000 +0000 +++ exec-maven-plugin-1.6.0/src/test/projects/project12/pom.xml 1970-01-01 00:00:00.000000000 +0000 @@ -1,72 +0,0 @@ - - 4.0.0 - org.cb.maven.plugins.exec - project1 - 0.1 - jar - Maven Exec Plugin - 2005 - - - Apache License 2 - http://www.apache.org/licenses/LICENSE-2.0.txt - repo - - - - - - Jerome Lacoste - jerome - jerome@coffeebreaks.org - CoffeeBreaks - http://www.coffeebreaks.org - - Java Developer - - +1 - - - - - - commons-io - commons-io - 1.1 - - - commons-logging - commons-logging - 1.0.4 - - - - - - - - org.codehaus.mojo - exec-maven-plugin - - - test - - java - - - - - org.codehaus.mojo.exec.NoMain - - - - - - - diff -Nru exec-maven-plugin-1.1.1+dfsg/src/test/projects/project15/pom.xml exec-maven-plugin-1.6.0/src/test/projects/project15/pom.xml --- exec-maven-plugin-1.1.1+dfsg/src/test/projects/project15/pom.xml 1970-01-01 00:00:00.000000000 +0000 +++ exec-maven-plugin-1.6.0/src/test/projects/project15/pom.xml 2017-03-02 20:58:24.000000000 +0000 @@ -0,0 +1,47 @@ + + 4.0.0 + org.cb.maven.plugins.exec + project8 + 0.1 + jar + Maven Exec Plugin + 2005 + + + Apache License 2 + http://www.apache.org/licenses/LICENSE-2.0.txt + repo + + + + + + Lukasz Cwik + lcwik + lcwik@google.com + Google Inc. + https://www.google.com/about/company/ + + + + + + + org.codehaus.mojo + exec-maven-plugin + + + test + + java + + + + + org.codehaus.mojo.exec.ThrowingMain + + + + + + diff -Nru exec-maven-plugin-1.1.1+dfsg/src/test/projects/project3/src/main/java/org/codehaus/mojo/exec/test3/Test.java exec-maven-plugin-1.6.0/src/test/projects/project3/src/main/java/org/codehaus/mojo/exec/test3/Test.java --- exec-maven-plugin-1.1.1+dfsg/src/test/projects/project3/src/main/java/org/codehaus/mojo/exec/test3/Test.java 2009-11-26 14:32:10.000000000 +0000 +++ exec-maven-plugin-1.6.0/src/test/projects/project3/src/main/java/org/codehaus/mojo/exec/test3/Test.java 2017-03-02 20:58:24.000000000 +0000 @@ -29,7 +29,7 @@ /** * @author Jerome Lacoste - * @version $Id: Test.java 6588 2008-03-28 12:22:57Z bentmann $ + * @version $Id$ * @todo we depend too much on Commandline.toString() */ public class Test diff -Nru exec-maven-plugin-1.1.1+dfsg/.travis.yml exec-maven-plugin-1.6.0/.travis.yml --- exec-maven-plugin-1.1.1+dfsg/.travis.yml 1970-01-01 00:00:00.000000000 +0000 +++ exec-maven-plugin-1.6.0/.travis.yml 2017-03-02 20:58:24.000000000 +0000 @@ -0,0 +1,14 @@ +language: java +jdk: + - oraclejdk7 + - oraclejdk8 +script: "mvn --show-version --errors --batch-mode -Prun-its clean verify" +cache: + directories: + - $HOME/.m2 +branches: + except: + - gh-pages +notifications: + email: + - khmarbaise@apache.org