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.0org.codehaus.mojomojo-parent
- 20
+ 40exec-maven-plugin
- 1.1.1
+ 1.6.0maven-pluginExec Maven PluginA plugin to allow execution of system and Java programs
- http://mojo.codehaus.org/exec-maven-plugin
+ http://www.mojohaus.org/exec-maven-plugin2005
- 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.0org.apache.mavenmaven-toolchain
- 1.0
+ ${mavenVersion}org.apache.mavenmaven-project
- 2.0.6
+ ${mavenVersion}org.apache.mavenmaven-model
- 2.0.6
+ ${mavenVersion}org.apache.mavenmaven-artifact
- 2.0.6
+ ${mavenVersion}org.apache.mavenmaven-artifact-manager
- 2.0.6
+ ${mavenVersion}org.apache.mavenmaven-core
- 2.0.6
+ ${mavenVersion}
+
org.apache.mavenmaven-plugin-api
- 2.0.6
+ ${mavenVersion}org.codehaus.plexusplexus-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.sharedmaven-plugin-testing-harness
- 1.0-beta-1
+ 1.1test
+
+ 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
+
+
+
+ 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:
+ *
+ *
relative to the root of the project
+ *
as toolchain executable
+ *
relative to the working directory (Windows only)
+ *
relative to the directories specified in the system property PATH (Windows Only)
+ *
+ * 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()
- {
- }
-
+ /**
+ *
+ *
+ * @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