diff -Nru build-helper-maven-plugin-1.8/debian/changelog build-helper-maven-plugin-3.0.0/debian/changelog --- build-helper-maven-plugin-1.8/debian/changelog 2014-01-01 12:18:40.000000000 +0000 +++ build-helper-maven-plugin-3.0.0/debian/changelog 2017-07-19 23:25:54.000000000 +0000 @@ -1,3 +1,20 @@ +build-helper-maven-plugin (3.0.0-1) unstable; urgency=medium + + * New upstream release + - New dependency on libmaven-file-management-java + - New build dependency on libassertj-core-java and testng + - Depend on libmaven3-core-java instead of libmaven2-core-java + * Enabled the unit tests + * Build with the DH sequencer instead of CDBS + * Track and download the new releases from GitHub + * Removed the -java-doc package + * Standards-Version updated to 4.0.0 + * Switch to debhelper level 10 + * Use secure Vcs-* URLs + * Updated the Homepage field + + -- Emmanuel Bourg Thu, 20 Jul 2017 01:25:54 +0200 + build-helper-maven-plugin (1.8-1) unstable; urgency=low * New upstream release diff -Nru build-helper-maven-plugin-1.8/debian/compat build-helper-maven-plugin-3.0.0/debian/compat --- build-helper-maven-plugin-1.8/debian/compat 2014-01-01 10:15:23.000000000 +0000 +++ build-helper-maven-plugin-3.0.0/debian/compat 2017-07-19 23:09:00.000000000 +0000 @@ -1 +1 @@ -9 +10 diff -Nru build-helper-maven-plugin-1.8/debian/control build-helper-maven-plugin-3.0.0/debian/control --- build-helper-maven-plugin-1.8/debian/control 2014-01-01 10:17:06.000000000 +0000 +++ build-helper-maven-plugin-3.0.0/debian/control 2017-07-19 23:25:54.000000000 +0000 @@ -2,46 +2,33 @@ Section: java Priority: optional Maintainer: Debian Java Maintainers -Uploaders: Damien Raude-Morvan , - Matthias Schmitz , - Emmanuel Bourg -Build-Depends: cdbs, debhelper (>= 9), default-jdk, maven-debian-helper (>= 1.4) -Build-Depends-Indep: default-jdk-doc, - libmaven-invoker-plugin-java, - libmaven-javadoc-plugin-java, - libmaven-plugin-tools-java (>= 3.0), - libmaven2-core-java, - libmaven2-core-java-doc, - libplexus-utils-java -Standards-Version: 3.9.5 -Vcs-Git: git://anonscm.debian.org/pkg-java/build-helper-maven-plugin.git -Vcs-Browser: http://anonscm.debian.org/gitweb/?p=pkg-java/build-helper-maven-plugin.git -Homepage: http://mojo.codehaus.org/build-helper-maven-plugin/ +Uploaders: + Damien Raude-Morvan , + Matthias Schmitz , + Emmanuel Bourg +Build-Depends: + debhelper (>= 10), + default-jdk, + libassertj-core-java, + libmaven-file-management-java, + libmaven-invoker-plugin-java, + libmaven-plugin-tools-java (>= 3.0), + libmaven3-core-java, + libplexus-utils-java, + maven-debian-helper (>= 2.2), + testng +Standards-Version: 4.0.0 +Vcs-Git: https://anonscm.debian.org/git/pkg-java/build-helper-maven-plugin.git +Vcs-Browser: https://anonscm.debian.org/cgit/pkg-java/build-helper-maven-plugin.git +Homepage: http://www.mojohaus.org/build-helper-maven-plugin/ Package: libbuild-helper-maven-plugin-java Architecture: all Depends: ${maven:Depends}, ${misc:Depends} Recommends: ${maven:OptionalDepends} -Suggests: libbuild-helper-maven-plugin-java-doc Description: Build Helper Maven Plugin This plugin contains various small independent goals to assist with Maven build lifecycle. . For example: attach some directory as new source folder, extract maven current version, parse and resolve a version property or reserve a random network port. - -Package: libbuild-helper-maven-plugin-java-doc -Architecture: all -Section: doc -Depends: ${maven:DocDepends}, ${misc:Depends} -Recommends: ${maven:DocOptionalDepends} -Suggests: libbuild-helper-maven-plugin-java -Description: Documentation for Build Helper Maven Plugin - This plugin contains various small independent goals to assist with Maven - build lifecycle. - . - For example: attach some directory as new source folder, extract maven current - version, parse and resolve a version property or reserve a random network port. - . - This package contains the API documentation of - libbuild-helper-maven-plugin-java. diff -Nru build-helper-maven-plugin-1.8/debian/copyright build-helper-maven-plugin-3.0.0/debian/copyright --- build-helper-maven-plugin-1.8/debian/copyright 2013-10-31 21:43:37.000000000 +0000 +++ build-helper-maven-plugin-3.0.0/debian/copyright 2017-07-19 23:25:54.000000000 +0000 @@ -1,7 +1,7 @@ -Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ +Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ Upstream-Name: Build Helper Maven Plugin Upstream-Contact: Dan Tran -Source: http://mojo.codehaus.org/build-helper-maven-plugin/ +Source: https://github.com/mojohaus/build-helper-maven-plugin Files: * Copyright: 2004, The Codehaus diff -Nru build-helper-maven-plugin-1.8/debian/libbuild-helper-maven-plugin-java-doc.doc-base.api build-helper-maven-plugin-3.0.0/debian/libbuild-helper-maven-plugin-java-doc.doc-base.api --- build-helper-maven-plugin-1.8/debian/libbuild-helper-maven-plugin-java-doc.doc-base.api 2013-10-31 21:40:35.000000000 +0000 +++ build-helper-maven-plugin-3.0.0/debian/libbuild-helper-maven-plugin-java-doc.doc-base.api 1970-01-01 00:00:00.000000000 +0000 @@ -1,10 +0,0 @@ -Document: libbuild-helper-maven-plugin-java -Title: API Javadoc for Build Helper Maven Plugin -Author: Build Helper Maven Plugin developers -Abstract: This is the API Javadoc provided for the - libbuild-helper-maven-plugin-java library. -Section: Programming - -Format: HTML -Index: /usr/share/doc/libbuild-helper-maven-plugin-java/api/index.html -Files: /usr/share/doc/libbuild-helper-maven-plugin-java/api/* diff -Nru build-helper-maven-plugin-1.8/debian/libbuild-helper-maven-plugin-java-doc.install build-helper-maven-plugin-3.0.0/debian/libbuild-helper-maven-plugin-java-doc.install --- build-helper-maven-plugin-1.8/debian/libbuild-helper-maven-plugin-java-doc.install 2013-10-31 21:43:57.000000000 +0000 +++ build-helper-maven-plugin-3.0.0/debian/libbuild-helper-maven-plugin-java-doc.install 1970-01-01 00:00:00.000000000 +0000 @@ -1,2 +0,0 @@ -target/apidocs/* usr/share/doc/libbuild-helper-maven-plugin-java/api - diff -Nru build-helper-maven-plugin-1.8/debian/maven.cleanIgnoreRules build-helper-maven-plugin-3.0.0/debian/maven.cleanIgnoreRules --- build-helper-maven-plugin-1.8/debian/maven.cleanIgnoreRules 2014-01-01 10:19:23.000000000 +0000 +++ build-helper-maven-plugin-3.0.0/debian/maven.cleanIgnoreRules 1970-01-01 00:00:00.000000000 +0000 @@ -1 +0,0 @@ - diff -Nru build-helper-maven-plugin-1.8/debian/maven.properties build-helper-maven-plugin-3.0.0/debian/maven.properties --- build-helper-maven-plugin-1.8/debian/maven.properties 2014-01-01 12:08:54.000000000 +0000 +++ build-helper-maven-plugin-3.0.0/debian/maven.properties 2017-07-19 23:25:54.000000000 +0000 @@ -1,5 +1,5 @@ # Include here properties to pass to Maven during the build. -maven.test.skip=true +maven.test.skip=false maven.compiler.source=1.5 maven.compiler.target=1.5 project.build.sourceEncoding=UTF-8 diff -Nru build-helper-maven-plugin-1.8/debian/maven.publishedRules build-helper-maven-plugin-3.0.0/debian/maven.publishedRules --- build-helper-maven-plugin-1.8/debian/maven.publishedRules 2014-01-01 10:19:23.000000000 +0000 +++ build-helper-maven-plugin-3.0.0/debian/maven.publishedRules 1970-01-01 00:00:00.000000000 +0000 @@ -1 +0,0 @@ - diff -Nru build-helper-maven-plugin-1.8/debian/maven.rules build-helper-maven-plugin-3.0.0/debian/maven.rules --- build-helper-maven-plugin-1.8/debian/maven.rules 2014-01-01 10:19:23.000000000 +0000 +++ build-helper-maven-plugin-3.0.0/debian/maven.rules 2017-07-19 23:25:54.000000000 +0000 @@ -1 +1,5 @@ - +junit junit * s/.*/4.x/ * * +org.testng testng * s/.*/6.x/ * * +org.apache.maven maven-compat * s/.*/3.x/ * * +org.apache.maven maven-core * s/.*/3.x/ * * +org.apache.maven maven-plugin-api * s/.*/3.x/ * * diff -Nru build-helper-maven-plugin-1.8/debian/orig-tar.sh build-helper-maven-plugin-3.0.0/debian/orig-tar.sh --- build-helper-maven-plugin-1.8/debian/orig-tar.sh 2013-10-31 21:40:35.000000000 +0000 +++ build-helper-maven-plugin-3.0.0/debian/orig-tar.sh 1970-01-01 00:00:00.000000000 +0000 @@ -1,16 +0,0 @@ -#!/bin/sh -e - -VERSION=$2 -TAR=../build-helper-maven-plugin_$VERSION.orig.tar.gz -DIR=build-helper-maven-plugin-$VERSION -TAG=$(echo "build-helper-maven-plugin-$VERSION" | sed -re's/~(alpha|beta)/-\1-/') - -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 build-helper-maven-plugin-1.8/debian/patches/01-maven-compatibility.patch build-helper-maven-plugin-3.0.0/debian/patches/01-maven-compatibility.patch --- build-helper-maven-plugin-1.8/debian/patches/01-maven-compatibility.patch 1970-01-01 00:00:00.000000000 +0000 +++ build-helper-maven-plugin-3.0.0/debian/patches/01-maven-compatibility.patch 2017-07-19 23:18:04.000000000 +0000 @@ -0,0 +1,17 @@ +Description: Fixes the compatibility with the version of Maven in Debian +Author: Emmanuel Bourg +Forwarded: no +--- a/pom.xml ++++ b/pom.xml +@@ -88,6 +88,11 @@ + ${mavenVersion} + + ++ org.apache.maven ++ maven-compat ++ ${mavenVersion} ++ ++ + org.apache.maven.plugin-tools + maven-plugin-annotations + 3.5 diff -Nru build-helper-maven-plugin-1.8/debian/patches/02-add-junit-dependency.patch build-helper-maven-plugin-3.0.0/debian/patches/02-add-junit-dependency.patch --- build-helper-maven-plugin-1.8/debian/patches/02-add-junit-dependency.patch 1970-01-01 00:00:00.000000000 +0000 +++ build-helper-maven-plugin-3.0.0/debian/patches/02-add-junit-dependency.patch 2017-07-19 23:25:54.000000000 +0000 @@ -0,0 +1,18 @@ +Description: Adds the missing junit dependency which should be inherited from the (ignored) parent pom +Author: Emmanuel Bourg +Forwarded: not-needed +--- a/pom.xml ++++ b/pom.xml +@@ -125,6 +125,12 @@ + 1.7.1 + test + ++ ++ junit ++ junit ++ 4.12 ++ test ++ + + + diff -Nru build-helper-maven-plugin-1.8/debian/patches/series build-helper-maven-plugin-3.0.0/debian/patches/series --- build-helper-maven-plugin-1.8/debian/patches/series 1970-01-01 00:00:00.000000000 +0000 +++ build-helper-maven-plugin-3.0.0/debian/patches/series 2017-07-19 23:25:54.000000000 +0000 @@ -0,0 +1,2 @@ +01-maven-compatibility.patch +02-add-junit-dependency.patch diff -Nru build-helper-maven-plugin-1.8/debian/README.source build-helper-maven-plugin-3.0.0/debian/README.source --- build-helper-maven-plugin-1.8/debian/README.source 2013-10-31 21:40:35.000000000 +0000 +++ build-helper-maven-plugin-3.0.0/debian/README.source 2017-07-19 23:25:54.000000000 +0000 @@ -1,5 +1,5 @@ Information about build-helper-maven-plugin ------------------------------- +------------------------------------------- This package was debianized using the mh_make command from the maven-debian-helper package. diff -Nru build-helper-maven-plugin-1.8/debian/rules build-helper-maven-plugin-3.0.0/debian/rules --- build-helper-maven-plugin-1.8/debian/rules 2013-10-31 21:40:35.000000000 +0000 +++ build-helper-maven-plugin-3.0.0/debian/rules 2017-07-19 23:09:00.000000000 +0000 @@ -1,14 +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 --download-version $(DEB_UPSTREAM_VERSION) --force-download --rename - -clean:: - mh_clean - -rm mvn-build - -rm -r debian/null \ No newline at end of file + uscan --download-current-version --force-download --rename diff -Nru build-helper-maven-plugin-1.8/debian/watch build-helper-maven-plugin-3.0.0/debian/watch --- build-helper-maven-plugin-1.8/debian/watch 2013-10-31 21:40:35.000000000 +0000 +++ build-helper-maven-plugin-3.0.0/debian/watch 2017-07-19 23:09:00.000000000 +0000 @@ -1,4 +1,2 @@ version=3 -opts="uversionmangle=s/-(alpha|beta)-/~$1/" \ - http://svn.codehaus.org/mojo/tags/ \ - build-helper-maven-plugin-(\d.*)/ debian debian/orig-tar.sh +https://github.com/mojohaus/build-helper-maven-plugin/tags .*/build-helper-maven-plugin-([\d\.]+).tar.gz diff -Nru build-helper-maven-plugin-1.8/.gitignore build-helper-maven-plugin-3.0.0/.gitignore --- build-helper-maven-plugin-1.8/.gitignore 1970-01-01 00:00:00.000000000 +0000 +++ build-helper-maven-plugin-3.0.0/.gitignore 2017-01-29 19:58:46.000000000 +0000 @@ -0,0 +1,7 @@ +target +.settings +.classpath +.project +*.iml +/bin +test-output diff -Nru build-helper-maven-plugin-1.8/LICENSE.txt build-helper-maven-plugin-3.0.0/LICENSE.txt --- build-helper-maven-plugin-1.8/LICENSE.txt 1970-01-01 00:00:00.000000000 +0000 +++ build-helper-maven-plugin-3.0.0/LICENSE.txt 2017-01-29 19:58:46.000000000 +0000 @@ -0,0 +1,23 @@ + +The MIT License + +Copyright 2006-2012 The Codehaus. +Copyright 2015-2016 The MojoHaus. + +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. diff -Nru build-helper-maven-plugin-1.8/pom.xml build-helper-maven-plugin-3.0.0/pom.xml --- build-helper-maven-plugin-1.8/pom.xml 2013-03-27 20:11:51.000000000 +0000 +++ build-helper-maven-plugin-3.0.0/pom.xml 2017-01-29 19:58:46.000000000 +0000 @@ -5,12 +5,13 @@ org.codehaus.mojo mojo-parent - 30 + 40 build-helper-maven-plugin - 1.8 + 3.0.0 maven-plugin + http://www.mojohaus.org/build-helper-maven-plugin/ Build Helper Maven Plugin This plugin contains various small independent goals to assist with Maven build lifecycle @@ -18,11 +19,11 @@ The MIT License - http://www.opensource.org/licenses/mit-license.php + https://opensource.org/licenses/mit-license.php repo - - + + Dan Tran @@ -40,40 +41,44 @@ +1 + + khmarbaise + Karl Heinz Marbaise + khmarbaise@apache.org + + Developer + + +1 + - + ${mavenVersion} - scm:svn:http://svn.codehaus.org/mojo/tags/build-helper-maven-plugin-1.8 - scm:svn:https://svn.codehaus.org/mojo/tags/build-helper-maven-plugin-1.8 - http://svn.codehaus.org/mojo/tags/build-helper-maven-plugin-1.8 + scm:git:https://github.com/mojohaus/build-helper-maven-plugin.git + scm:git:ssh://git@github.com/mojohaus/build-helper-maven-plugin.git + https://github.com/mojohaus/build-helper-maven-plugin + build-helper-maven-plugin-3.0.0 - JIRA - http://jira.codehaus.org/browse/MBUILDHELPER + GitHub + https://github.com/mojohaus/build-helper-maven-plugin/issues/ + + Travis-CI + https://travis-ci.org/mojohaus/build-helper-maven-plugin + - 2.0.6 - 1.5 + 3.0 + ${project.build.directory}/staging/build-helper-maven-plugin org.apache.maven - maven-model - ${mavenVersion} - - - org.apache.maven - maven-project - ${mavenVersion} - - - org.apache.maven maven-core ${mavenVersion} @@ -83,53 +88,49 @@ ${mavenVersion} - org.apache.maven - maven-artifact - ${mavenVersion} - - org.apache.maven.plugin-tools maven-plugin-annotations - 3.1 + 3.5 provided org.codehaus.plexus plexus-utils - 1.5.8 + 3.0.24 org.beanshell bsh 2.0b4 + + org.testng + testng + 6.9.9 + test + + + org.apache.maven.shared + file-management + 3.0.0 + + + org.assertj + assertj-core + 1.7.1 + test + - - - - org.apache.maven.plugins - maven-plugin-plugin - 3.1 - - - org.apache.maven.plugins maven-plugin-plugin + 3.5 true - - - mojo-descriptor - - descriptor - - - @@ -145,35 +146,6 @@ header.txt - - org.apache.maven.plugins - maven-changes-plugin - 2.5 - - - - jira-report - - - - - http://jira.codehaus.org/browse/%ISSUE% - true - Fixed - Resolved,Closed - Bug, New Feature, Improvement, Wish - - - - org.apache.maven.plugins - maven-changelog-plugin - 2.2 - - - org.apache.maven.plugins - maven-plugin-plugin - 3.1 - @@ -193,6 +165,7 @@ maven-invoker-plugin true + true verify ${project.build.directory}/local-repo src/it/settings.xml diff -Nru build-helper-maven-plugin-1.8/README.md build-helper-maven-plugin-3.0.0/README.md --- build-helper-maven-plugin-1.8/README.md 1970-01-01 00:00:00.000000000 +0000 +++ build-helper-maven-plugin-3.0.0/README.md 2017-01-29 19:58:46.000000000 +0000 @@ -0,0 +1,23 @@ +# MojoHaus Build Helper Maven Plugin + +[![The MIT License](https://img.shields.io/github/license/mojohaus/build-helper-maven-plugin.svg?label=License)](https://opensource.org/licenses/MIT) +[![Maven Central](https://img.shields.io/maven-central/v/org.codehaus.mojo/build-helper-maven-plugin.svg?label=Maven%20Central)](http://search.maven.org/#search%7Cga%7C1%7Cbuild-helper-maven-plugin) +[![Build Status](https://travis-ci.org/mojohaus/build-helper-maven-plugin.svg?branch=master)](https://travis-ci.org/mojohaus/build-helper-maven-plugin) + +This is the [build-helper-maven-plugin](http://www.mojohaus.org/build-helper-maven-plugin/) contains +serveral goals to support you in different kinds of task, like parsing version information, +add supplemental source/test folders to a Maven project or attach supplemental artifacts. + +More details can be found on the [goals overview page](http://www.mojohaus.org/build-helper-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 build-helper-maven-plugin-1.8/src/it/mbuildhelper-34/invoker.properties build-helper-maven-plugin-3.0.0/src/it/mbuildhelper-34/invoker.properties --- build-helper-maven-plugin-1.8/src/it/mbuildhelper-34/invoker.properties 1970-01-01 00:00:00.000000000 +0000 +++ build-helper-maven-plugin-3.0.0/src/it/mbuildhelper-34/invoker.properties 2017-01-29 19:58:46.000000000 +0000 @@ -0,0 +1,3 @@ +invoker.goals = validate +invoker.buildResult = success +invoker.maven.version = 3.1.0-alpha-1+ \ No newline at end of file diff -Nru build-helper-maven-plugin-1.8/src/it/mbuildhelper-34/pom.xml build-helper-maven-plugin-3.0.0/src/it/mbuildhelper-34/pom.xml --- build-helper-maven-plugin-1.8/src/it/mbuildhelper-34/pom.xml 1970-01-01 00:00:00.000000000 +0000 +++ build-helper-maven-plugin-3.0.0/src/it/mbuildhelper-34/pom.xml 2017-01-29 19:58:46.000000000 +0000 @@ -0,0 +1,51 @@ + + 4.0.0 + + org.codehaus.mojo + build-helper-mbuildhelper-34 + 1-SNAPSHOT + jar + + Regex valid with spaces replacement + + + + src/main/resources + + test.properties + + false + + + src/main/resources + + test.properties + + true + + + + + @project.groupId@ + @project.artifactId@ + @project.version@ + + + + regex-property + + + propname + chapi chapo bidiba + chapo + + true + + + + + + + + \ No newline at end of file diff -Nru build-helper-maven-plugin-1.8/src/it/mbuildhelper-34/verify.groovy build-helper-maven-plugin-3.0.0/src/it/mbuildhelper-34/verify.groovy --- build-helper-maven-plugin-1.8/src/it/mbuildhelper-34/verify.groovy 1970-01-01 00:00:00.000000000 +0000 +++ build-helper-maven-plugin-3.0.0/src/it/mbuildhelper-34/verify.groovy 2017-01-29 19:58:46.000000000 +0000 @@ -0,0 +1,8 @@ +File file = new File( basedir, "build.log" ); +assert file.exists(); + +String text = file.getText("utf-8"); + +assert text.contains('define property propname = "chapi bidiba"') + +return true; diff -Nru build-helper-maven-plugin-1.8/src/it/parse-version/invoker.properties build-helper-maven-plugin-3.0.0/src/it/parse-version/invoker.properties --- build-helper-maven-plugin-1.8/src/it/parse-version/invoker.properties 1970-01-01 00:00:00.000000000 +0000 +++ build-helper-maven-plugin-3.0.0/src/it/parse-version/invoker.properties 2017-01-29 19:58:46.000000000 +0000 @@ -0,0 +1,3 @@ +invoker.goals = test +invoker.buildResult = success +invoker.debug = true diff -Nru build-helper-maven-plugin-1.8/src/it/parse-version/pom.xml build-helper-maven-plugin-3.0.0/src/it/parse-version/pom.xml --- build-helper-maven-plugin-1.8/src/it/parse-version/pom.xml 1970-01-01 00:00:00.000000000 +0000 +++ build-helper-maven-plugin-3.0.0/src/it/parse-version/pom.xml 2017-01-29 19:58:46.000000000 +0000 @@ -0,0 +1,37 @@ + + + 4.0.0 + + org.codehaus.mojo + build-helper-maven-plugin-reverse-port-it + 20.4.00.0-SNAPSHOT + + build-helper-maven-plugin-parse-version-it + + + + + package + + + + + + + @project.groupId@ + @project.artifactId@ + @project.version@ + + + + parse-version-001 + + parse-version + + + + + + + + diff -Nru build-helper-maven-plugin-1.8/src/it/parse-version/verify.groovy build-helper-maven-plugin-3.0.0/src/it/parse-version/verify.groovy --- build-helper-maven-plugin-1.8/src/it/parse-version/verify.groovy 1970-01-01 00:00:00.000000000 +0000 +++ build-helper-maven-plugin-3.0.0/src/it/parse-version/verify.groovy 2017-01-29 19:58:46.000000000 +0000 @@ -0,0 +1,24 @@ + +File file = new File( basedir, "build.log" ); +assert file.exists(); + +String text = file.getText("utf-8"); + +assert text.contains("major: 20") +assert text.contains("minor: 4") +assert text.contains("incremental: 0") +assert text.contains("buildnumber: 0") +assert text.contains("qualifier: 0-SNAPSHOT") + +assert text.contains("define property parsedVersion.majorVersion = \"20\"") +assert text.contains("define property parsedVersion.minorVersion = \"4\"") +assert text.contains("define property parsedVersion.incrementalVersion = \"0\"") +assert text.contains("define property parsedVersion.nextMajorVersion = \"21\"") +assert text.contains("define property parsedVersion.nextMinorVersion = \"5\"") +assert text.contains("define property parsedVersion.nextIncrementalVersion = \"1\"") +assert text.contains("define property parsedVersion.nextBuildNumber = \"1\"") +assert text.contains("define property parsedVersion.qualifier = \"0-SNAPSHOT\"") +assert text.contains("define property parsedVersion.buildNumber = \"0\"") +assert text.contains("define property parsedVersion.osgiVersion = \"20.4.0.0-SNAPSHOT\"") + +return true; diff -Nru build-helper-maven-plugin-1.8/src/it/regex-multi/invoker.properties build-helper-maven-plugin-3.0.0/src/it/regex-multi/invoker.properties --- build-helper-maven-plugin-1.8/src/it/regex-multi/invoker.properties 1970-01-01 00:00:00.000000000 +0000 +++ build-helper-maven-plugin-3.0.0/src/it/regex-multi/invoker.properties 2017-01-29 19:58:46.000000000 +0000 @@ -0,0 +1 @@ +invoker.goals=compile diff -Nru build-helper-maven-plugin-1.8/src/it/regex-multi/pom.xml build-helper-maven-plugin-3.0.0/src/it/regex-multi/pom.xml --- build-helper-maven-plugin-1.8/src/it/regex-multi/pom.xml 1970-01-01 00:00:00.000000000 +0000 +++ build-helper-maven-plugin-3.0.0/src/it/regex-multi/pom.xml 2017-01-29 19:58:46.000000000 +0000 @@ -0,0 +1,59 @@ + + 4.0.0 + + org.codehaus.mojo + build-helper-maven-plugin-regex-multi-valid-it + 1-SNAPSHOT + jar + + Regex Multi + + Tests that a valid regex gets applied + + + + + + src/main/resources + + test.properties + + false + + + src/main/resources + + test.properties + + true + + + + + @project.groupId@ + @project.artifactId@ + @project.version@ + + + + regex-properties + + + + + build.version + ${project.version} + -SNAPSHOT + -RC + false + + + + + + + + + + \ No newline at end of file diff -Nru build-helper-maven-plugin-1.8/src/it/regex-multi/src/main/resources/test.properties build-helper-maven-plugin-3.0.0/src/it/regex-multi/src/main/resources/test.properties --- build-helper-maven-plugin-1.8/src/it/regex-multi/src/main/resources/test.properties 1970-01-01 00:00:00.000000000 +0000 +++ build-helper-maven-plugin-3.0.0/src/it/regex-multi/src/main/resources/test.properties 2017-01-29 19:58:46.000000000 +0000 @@ -0,0 +1 @@ +version=${build.version} \ No newline at end of file diff -Nru build-helper-maven-plugin-1.8/src/it/regex-multi/verify.bsh build-helper-maven-plugin-3.0.0/src/it/regex-multi/verify.bsh --- build-helper-maven-plugin-1.8/src/it/regex-multi/verify.bsh 1970-01-01 00:00:00.000000000 +0000 +++ build-helper-maven-plugin-3.0.0/src/it/regex-multi/verify.bsh 2017-01-29 19:58:46.000000000 +0000 @@ -0,0 +1,23 @@ +import java.io.*; +import java.util.*; + +try +{ + File file = new File( basedir, "target/classes/test.properties" ); + Properties p = new Properties(); + p.load( new FileInputStream( file ) ); + String value = p.getProperty( "version" ); + + if ( value.indexOf( "-RC" ) < 0 ) + { + System.err.println( "Regex not applied" ); + return false; + } +} +catch( Throwable t ) +{ + t.printStackTrace(); + return false; +} + +return true; diff -Nru build-helper-maven-plugin-1.8/src/it/reserve-ports-with-min-root-range/invoker.properties build-helper-maven-plugin-3.0.0/src/it/reserve-ports-with-min-root-range/invoker.properties --- build-helper-maven-plugin-1.8/src/it/reserve-ports-with-min-root-range/invoker.properties 2013-03-27 14:51:22.000000000 +0000 +++ build-helper-maven-plugin-3.0.0/src/it/reserve-ports-with-min-root-range/invoker.properties 2017-01-29 19:58:46.000000000 +0000 @@ -1,2 +1,3 @@ invoker.goals = test invoker.buildResult = success +invoker.os.family = unix \ No newline at end of file diff -Nru build-helper-maven-plugin-1.8/src/it/reserve-ports-with-random/pom.xml build-helper-maven-plugin-3.0.0/src/it/reserve-ports-with-random/pom.xml --- build-helper-maven-plugin-1.8/src/it/reserve-ports-with-random/pom.xml 1970-01-01 00:00:00.000000000 +0000 +++ build-helper-maven-plugin-3.0.0/src/it/reserve-ports-with-random/pom.xml 2017-01-29 19:58:46.000000000 +0000 @@ -0,0 +1,93 @@ + + + 4.0.0 + + org.codehaus.mojo + build-helper-maven-plugin-reverse-port-it + 1.0-SNAPSHOT + + build-helper-maven-plugin-reverse-port-it + + + + + package + + + + + + + @project.groupId@ + @project.artifactId@ + @project.version@ + + + + reserve-ports + process-test-resources + + reserve-network-port + + + + port1 + port2 + port3 + + 9000 + 9005 + true + + + + + + + + maven-antrun-plugin + 1.8 + + + mk-target-dir + compile + + run + + + + + + + + + + echo-reserve-ports + test + + run + + + + port1=${port1} + port2=${port2} + port3=${port3} + + + + + + + + + + + + + diff -Nru build-helper-maven-plugin-1.8/src/it/reserve-ports-with-random/verify.groovy build-helper-maven-plugin-3.0.0/src/it/reserve-ports-with-random/verify.groovy --- build-helper-maven-plugin-1.8/src/it/reserve-ports-with-random/verify.groovy 1970-01-01 00:00:00.000000000 +0000 +++ build-helper-maven-plugin-3.0.0/src/it/reserve-ports-with-random/verify.groovy 2017-01-29 19:58:46.000000000 +0000 @@ -0,0 +1,11 @@ +File file = new File( basedir, "build.log" ); +assert file.exists(); + +String text = file.getText("utf-8"); + +// FIXME: That IT could fail if the port is already taken +// Only check if the reserved values are *higher* than 1024? +assert text.contains("port1=900") +assert text.contains("port2=900") +assert text.contains("port3=900") +return true; diff -Nru build-helper-maven-plugin-1.8/src/it/reserve-ports-with-sequence/invoker.properties build-helper-maven-plugin-3.0.0/src/it/reserve-ports-with-sequence/invoker.properties --- build-helper-maven-plugin-1.8/src/it/reserve-ports-with-sequence/invoker.properties 1970-01-01 00:00:00.000000000 +0000 +++ build-helper-maven-plugin-3.0.0/src/it/reserve-ports-with-sequence/invoker.properties 2017-01-29 19:58:46.000000000 +0000 @@ -0,0 +1,3 @@ +invoker.goals = test +invoker.buildResult = success +invoker.os.family = unix \ No newline at end of file diff -Nru build-helper-maven-plugin-1.8/src/it/reserve-ports-with-sequence/pom.xml build-helper-maven-plugin-3.0.0/src/it/reserve-ports-with-sequence/pom.xml --- build-helper-maven-plugin-1.8/src/it/reserve-ports-with-sequence/pom.xml 1970-01-01 00:00:00.000000000 +0000 +++ build-helper-maven-plugin-3.0.0/src/it/reserve-ports-with-sequence/pom.xml 2017-01-29 19:58:46.000000000 +0000 @@ -0,0 +1,93 @@ + + + 4.0.0 + + org.codehaus.mojo + build-helper-maven-plugin-reverse-port-it + 1.0-SNAPSHOT + + build-helper-maven-plugin-reverse-port-it + + + + + package + + + + + + + @project.groupId@ + @project.artifactId@ + @project.version@ + + + + reserve-ports + process-test-resources + + reserve-network-port + + + + port1 + port2 + port3 + + 9000 + 9005 + false + + + + + + + + maven-antrun-plugin + 1.8 + + + mk-target-dir + compile + + run + + + + + + + + + + echo-reserve-ports + test + + run + + + + port1=${port1} + port2=${port2} + port3=${port3} + + + + + + + + + + + + + diff -Nru build-helper-maven-plugin-1.8/src/it/reserve-ports-with-sequence/verify.groovy build-helper-maven-plugin-3.0.0/src/it/reserve-ports-with-sequence/verify.groovy --- build-helper-maven-plugin-1.8/src/it/reserve-ports-with-sequence/verify.groovy 1970-01-01 00:00:00.000000000 +0000 +++ build-helper-maven-plugin-3.0.0/src/it/reserve-ports-with-sequence/verify.groovy 2017-01-29 19:58:46.000000000 +0000 @@ -0,0 +1,11 @@ +File file = new File( basedir, "build.log" ); +assert file.exists(); + +String text = file.getText("utf-8"); + +// FIXME: That IT could fail if the port is already taken +// Only check if the reserved values are *higher* than 1024? +assert text.contains("port1=9000") +assert text.contains("port2=9001") +assert text.contains("port3=9002") +return true; diff -Nru build-helper-maven-plugin-1.8/src/it/reserve-ports-with-urls/invoker.properties build-helper-maven-plugin-3.0.0/src/it/reserve-ports-with-urls/invoker.properties --- build-helper-maven-plugin-1.8/src/it/reserve-ports-with-urls/invoker.properties 1970-01-01 00:00:00.000000000 +0000 +++ build-helper-maven-plugin-3.0.0/src/it/reserve-ports-with-urls/invoker.properties 2017-01-29 19:58:46.000000000 +0000 @@ -0,0 +1,2 @@ +invoker.goals = test +invoker.buildResult = success \ No newline at end of file diff -Nru build-helper-maven-plugin-1.8/src/it/reserve-ports-with-urls/names1.txt build-helper-maven-plugin-3.0.0/src/it/reserve-ports-with-urls/names1.txt --- build-helper-maven-plugin-1.8/src/it/reserve-ports-with-urls/names1.txt 1970-01-01 00:00:00.000000000 +0000 +++ build-helper-maven-plugin-3.0.0/src/it/reserve-ports-with-urls/names1.txt 2017-01-29 19:58:46.000000000 +0000 @@ -0,0 +1,4 @@ + # Port names +port1 +port2 +port3 \ No newline at end of file diff -Nru build-helper-maven-plugin-1.8/src/it/reserve-ports-with-urls/names2.txt build-helper-maven-plugin-3.0.0/src/it/reserve-ports-with-urls/names2.txt --- build-helper-maven-plugin-1.8/src/it/reserve-ports-with-urls/names2.txt 1970-01-01 00:00:00.000000000 +0000 +++ build-helper-maven-plugin-3.0.0/src/it/reserve-ports-with-urls/names2.txt 2017-01-29 19:58:46.000000000 +0000 @@ -0,0 +1,4 @@ + # Port names +port4 +port5 +port6 \ No newline at end of file diff -Nru build-helper-maven-plugin-1.8/src/it/reserve-ports-with-urls/pom.xml build-helper-maven-plugin-3.0.0/src/it/reserve-ports-with-urls/pom.xml --- build-helper-maven-plugin-1.8/src/it/reserve-ports-with-urls/pom.xml 1970-01-01 00:00:00.000000000 +0000 +++ build-helper-maven-plugin-3.0.0/src/it/reserve-ports-with-urls/pom.xml 2017-01-29 19:58:46.000000000 +0000 @@ -0,0 +1,79 @@ + + 4.0.0 + + org.codehaus.mojo + build-helper-maven-plugin-reverse-port-it + 1.0-SNAPSHOT + build-helper-maven-plugin-reverse-port-it + + + package + + + @project.groupId@ + @project.artifactId@ + @project.version@ + + + reserve-ports + process-test-resources + + reserve-network-port + + + + file://${project.basedir}/names2.txt + + + + + reserve-ports-to-files + process-test-resources + + reserve-network-port + + + ${project.build.directory}/ports.properties + + file://${project.basedir}/names1.txt + file://${project.basedir}/names2.txt + + + + + + + maven-antrun-plugin + + + mk-target-dir + compile + + run + + + + + + + + + + echo-reserve-ports + test + + run + + + + port1=${port1} + port2=${port2} + port3=${port3} + + + + + + + + diff -Nru build-helper-maven-plugin-1.8/src/it/reserve-ports-with-urls/verify.groovy build-helper-maven-plugin-3.0.0/src/it/reserve-ports-with-urls/verify.groovy --- build-helper-maven-plugin-1.8/src/it/reserve-ports-with-urls/verify.groovy 1970-01-01 00:00:00.000000000 +0000 +++ build-helper-maven-plugin-3.0.0/src/it/reserve-ports-with-urls/verify.groovy 2017-01-29 19:58:46.000000000 +0000 @@ -0,0 +1,10 @@ +File file = new File( basedir, "build.log" ); +assert file.exists(); + +String text = file.getText("utf-8"); + +assert text.contains("port1=") +assert text.contains("port2=") +assert text.contains("port3=") + +return true; diff -Nru build-helper-maven-plugin-1.8/src/it/uptodate-flatten/fixture.properties build-helper-maven-plugin-3.0.0/src/it/uptodate-flatten/fixture.properties --- build-helper-maven-plugin-1.8/src/it/uptodate-flatten/fixture.properties 1970-01-01 00:00:00.000000000 +0000 +++ build-helper-maven-plugin-3.0.0/src/it/uptodate-flatten/fixture.properties 2017-01-29 19:58:46.000000000 +0000 @@ -0,0 +1,15 @@ +src/main/resources/source/dirA/fileAA.s = 1 +src/main/resources/source/dirA/fileAB.s = 2 +src/main/resources/source/dirA/fileAX.s = 3 +src/main/resources/source/dirB/fileBA.s = 4 +src/main/resources/source/dirB/fileBB.s = 5 +src/main/resources/source/dirB/fileBX.s = 6 +src/main/resources/source/dirY/fileYA.s = 7 +src/main/resources/source/dirY/fileYB.s = 8 +src/main/resources/source/dirY/fileYX.s = 9 + +src/main/resources/target/fileAA.s = 1 +src/main/resources/target/fileAB.s = 3 +src/main/resources/target/fileAX.s = 0 +src/main/resources/target/fileBA.s = 5 +src/main/resources/target/fileBB.s = 6 diff -Nru build-helper-maven-plugin-1.8/src/it/uptodate-flatten/invoker.properties build-helper-maven-plugin-3.0.0/src/it/uptodate-flatten/invoker.properties --- build-helper-maven-plugin-1.8/src/it/uptodate-flatten/invoker.properties 1970-01-01 00:00:00.000000000 +0000 +++ build-helper-maven-plugin-3.0.0/src/it/uptodate-flatten/invoker.properties 2017-01-29 19:58:46.000000000 +0000 @@ -0,0 +1,2 @@ +invoker.goals = validate +#invoker.mavenOpts = -agentlib:jdwp=transport=dt_socket,server=y,suspend=y,address=8000 diff -Nru build-helper-maven-plugin-1.8/src/it/uptodate-flatten/pom.xml build-helper-maven-plugin-3.0.0/src/it/uptodate-flatten/pom.xml --- build-helper-maven-plugin-1.8/src/it/uptodate-flatten/pom.xml 1970-01-01 00:00:00.000000000 +0000 +++ build-helper-maven-plugin-3.0.0/src/it/uptodate-flatten/pom.xml 2017-01-29 19:58:46.000000000 +0000 @@ -0,0 +1,64 @@ + + 4.0.0 + + org.codehaus.mojo + build-helper-maven-plugin-uptodate-flatten-it + 1-SNAPSHOT + jar + + UpToDate Flatten + Tests that uptodate-property with flatten mapping works + + + + + src/main/resources + + test.properties + + false + + + src/main/resources + + test.properties + + true + + + + + @project.groupId@ + @project.artifactId@ + @project.version@ + + + + uptodate-property + + + propname-flatten + uptodate + outofdate + + src/main/resources/source + src/main/resources/target + + dir*/** + + + **/*X* + **/*Y/** + + + flatten + + + + + + + + + + \ No newline at end of file diff -Nru build-helper-maven-plugin-1.8/src/it/uptodate-flatten/prebuild.groovy build-helper-maven-plugin-3.0.0/src/it/uptodate-flatten/prebuild.groovy --- build-helper-maven-plugin-1.8/src/it/uptodate-flatten/prebuild.groovy 1970-01-01 00:00:00.000000000 +0000 +++ build-helper-maven-plugin-3.0.0/src/it/uptodate-flatten/prebuild.groovy 2017-01-29 19:58:46.000000000 +0000 @@ -0,0 +1 @@ +org.codehaus.mojo.buildhelper.FixtureUtils.createResources( "target/it/uptodate-flatten" ) \ No newline at end of file diff -Nru build-helper-maven-plugin-1.8/src/it/uptodate-flatten/verify.groovy build-helper-maven-plugin-3.0.0/src/it/uptodate-flatten/verify.groovy --- build-helper-maven-plugin-1.8/src/it/uptodate-flatten/verify.groovy 1970-01-01 00:00:00.000000000 +0000 +++ build-helper-maven-plugin-3.0.0/src/it/uptodate-flatten/verify.groovy 2017-01-29 19:58:46.000000000 +0000 @@ -0,0 +1,9 @@ +File file = new File( basedir, "build.log" ); +assert file.exists(); + +String text = file.getText("utf-8"); + +assert !text.contains('define property propname-flatten = "outofdate"') : "Erroneously defined property propname-flatten = \"outofdate\"" +assert text.contains('define property propname-flatten = "uptodate"') : "Failed to define property propname-flatten = \"uptodate\"" + +return true; diff -Nru build-helper-maven-plugin-1.8/src/it/uptodate-glob/fixture.properties build-helper-maven-plugin-3.0.0/src/it/uptodate-glob/fixture.properties --- build-helper-maven-plugin-1.8/src/it/uptodate-glob/fixture.properties 1970-01-01 00:00:00.000000000 +0000 +++ build-helper-maven-plugin-3.0.0/src/it/uptodate-glob/fixture.properties 2017-01-29 19:58:46.000000000 +0000 @@ -0,0 +1,15 @@ +src/main/resources/source/dirA/fileAA.s = 1 +src/main/resources/source/dirA/fileAB.s = 2 +src/main/resources/source/dirA/fileAX.s = 3 +src/main/resources/source/dirB/fileBA.s = 4 +src/main/resources/source/dirB/fileBB.s = 5 +src/main/resources/source/dirB/fileBX.s = 6 +src/main/resources/source/dirY/fileYA.s = 7 +src/main/resources/source/dirY/fileYB.s = 8 +src/main/resources/source/dirY/fileYX.s = 9 + +src/main/resources/target/dirA/fileAA.t = 1 +src/main/resources/target/dirA/fileAB.t = 3 +src/main/resources/target/dirA/fileAX.t = 0 +src/main/resources/target/dirB/fileBA.t = 5 +src/main/resources/target/dirB/fileBB.t = 6 diff -Nru build-helper-maven-plugin-1.8/src/it/uptodate-glob/invoker.properties build-helper-maven-plugin-3.0.0/src/it/uptodate-glob/invoker.properties --- build-helper-maven-plugin-1.8/src/it/uptodate-glob/invoker.properties 1970-01-01 00:00:00.000000000 +0000 +++ build-helper-maven-plugin-3.0.0/src/it/uptodate-glob/invoker.properties 2017-01-29 19:58:46.000000000 +0000 @@ -0,0 +1,2 @@ +invoker.goals = validate +#invoker.mavenOpts = -agentlib:jdwp=transport=dt_socket,server=y,suspend=y,address=8000 diff -Nru build-helper-maven-plugin-1.8/src/it/uptodate-glob/pom.xml build-helper-maven-plugin-3.0.0/src/it/uptodate-glob/pom.xml --- build-helper-maven-plugin-1.8/src/it/uptodate-glob/pom.xml 1970-01-01 00:00:00.000000000 +0000 +++ build-helper-maven-plugin-3.0.0/src/it/uptodate-glob/pom.xml 2017-01-29 19:58:46.000000000 +0000 @@ -0,0 +1,66 @@ + + 4.0.0 + + org.codehaus.mojo + build-helper-maven-plugin-uptodate-glob-it + 1-SNAPSHOT + jar + + UpToDate Glob + Tests that uptodate-property with glob mapping works + + + + + src/main/resources + + test.properties + + false + + + src/main/resources + + test.properties + + true + + + + + @project.groupId@ + @project.artifactId@ + @project.version@ + + + + uptodate-property + + + propname-glob + uptodate + outofdate + + src/main/resources/source + src/main/resources/target + + dir*/** + + + **/*X* + **/*Y/** + + + glob + *.s + *.t + + + + + + + + + + \ No newline at end of file diff -Nru build-helper-maven-plugin-1.8/src/it/uptodate-glob/prebuild.groovy build-helper-maven-plugin-3.0.0/src/it/uptodate-glob/prebuild.groovy --- build-helper-maven-plugin-1.8/src/it/uptodate-glob/prebuild.groovy 1970-01-01 00:00:00.000000000 +0000 +++ build-helper-maven-plugin-3.0.0/src/it/uptodate-glob/prebuild.groovy 2017-01-29 19:58:46.000000000 +0000 @@ -0,0 +1 @@ +org.codehaus.mojo.buildhelper.FixtureUtils.createResources( "target/it/uptodate-glob" ) \ No newline at end of file diff -Nru build-helper-maven-plugin-1.8/src/it/uptodate-glob/verify.groovy build-helper-maven-plugin-3.0.0/src/it/uptodate-glob/verify.groovy --- build-helper-maven-plugin-1.8/src/it/uptodate-glob/verify.groovy 1970-01-01 00:00:00.000000000 +0000 +++ build-helper-maven-plugin-3.0.0/src/it/uptodate-glob/verify.groovy 2017-01-29 19:58:46.000000000 +0000 @@ -0,0 +1,9 @@ +File file = new File( basedir, "build.log" ); +assert file.exists(); + +String text = file.getText("utf-8"); + +assert !text.contains('define property propname-glob = "outofdate"') : "Erroneously defined property propname-glob = \"outofdate\"" +assert text.contains('define property propname-glob = "uptodate"') : "Failed to define property propname-glob = \"uptodate\"" + +return true; diff -Nru build-helper-maven-plugin-1.8/src/it/uptodate-identity/fixture.properties build-helper-maven-plugin-3.0.0/src/it/uptodate-identity/fixture.properties --- build-helper-maven-plugin-1.8/src/it/uptodate-identity/fixture.properties 1970-01-01 00:00:00.000000000 +0000 +++ build-helper-maven-plugin-3.0.0/src/it/uptodate-identity/fixture.properties 2017-01-29 19:58:46.000000000 +0000 @@ -0,0 +1,15 @@ +src/main/resources/source/dirA/fileAA.s = 1 +src/main/resources/source/dirA/fileAB.s = 2 +src/main/resources/source/dirA/fileAX.s = 3 +src/main/resources/source/dirB/fileBA.s = 4 +src/main/resources/source/dirB/fileBB.s = 5 +src/main/resources/source/dirB/fileBX.s = 6 +src/main/resources/source/dirY/fileYA.s = 7 +src/main/resources/source/dirY/fileYB.s = 8 +src/main/resources/source/dirY/fileYX.s = 9 + +src/main/resources/target/dirA/fileAA.s = 1 +src/main/resources/target/dirA/fileAB.s = 3 +src/main/resources/target/dirA/fileAX.s = 0 +src/main/resources/target/dirB/fileBA.s = 5 +src/main/resources/target/dirB/fileBB.s = 6 diff -Nru build-helper-maven-plugin-1.8/src/it/uptodate-identity/invoker.properties build-helper-maven-plugin-3.0.0/src/it/uptodate-identity/invoker.properties --- build-helper-maven-plugin-1.8/src/it/uptodate-identity/invoker.properties 1970-01-01 00:00:00.000000000 +0000 +++ build-helper-maven-plugin-3.0.0/src/it/uptodate-identity/invoker.properties 2017-01-29 19:58:46.000000000 +0000 @@ -0,0 +1,2 @@ +invoker.goals = validate +#invoker.mavenOpts = -agentlib:jdwp=transport=dt_socket,server=y,suspend=y,address=8000 diff -Nru build-helper-maven-plugin-1.8/src/it/uptodate-identity/pom.xml build-helper-maven-plugin-3.0.0/src/it/uptodate-identity/pom.xml --- build-helper-maven-plugin-1.8/src/it/uptodate-identity/pom.xml 1970-01-01 00:00:00.000000000 +0000 +++ build-helper-maven-plugin-3.0.0/src/it/uptodate-identity/pom.xml 2017-01-29 19:58:46.000000000 +0000 @@ -0,0 +1,62 @@ + + 4.0.0 + + org.codehaus.mojo + build-helper-maven-plugin-uptodate-identity-it + 1-SNAPSHOT + jar + + UpToDate Identity + Tests that uptodate-property with identity mapping works + + + + + src/main/resources + + test.properties + + false + + + src/main/resources + + test.properties + + true + + + + + @project.groupId@ + @project.artifactId@ + @project.version@ + + + + uptodate-property + + + propname-identity + uptodate + outofdate + outofdate + + src/main/resources/source + src/main/resources/target + + dir*/** + + + **/*X* + **/*Y/** + + + + + + + + + + \ No newline at end of file diff -Nru build-helper-maven-plugin-1.8/src/it/uptodate-identity/prebuild.groovy build-helper-maven-plugin-3.0.0/src/it/uptodate-identity/prebuild.groovy --- build-helper-maven-plugin-1.8/src/it/uptodate-identity/prebuild.groovy 1970-01-01 00:00:00.000000000 +0000 +++ build-helper-maven-plugin-3.0.0/src/it/uptodate-identity/prebuild.groovy 2017-01-29 19:58:46.000000000 +0000 @@ -0,0 +1 @@ +org.codehaus.mojo.buildhelper.FixtureUtils.createResources( "target/it/uptodate-identity" ) \ No newline at end of file diff -Nru build-helper-maven-plugin-1.8/src/it/uptodate-identity/verify.groovy build-helper-maven-plugin-3.0.0/src/it/uptodate-identity/verify.groovy --- build-helper-maven-plugin-1.8/src/it/uptodate-identity/verify.groovy 1970-01-01 00:00:00.000000000 +0000 +++ build-helper-maven-plugin-3.0.0/src/it/uptodate-identity/verify.groovy 2017-01-29 19:58:46.000000000 +0000 @@ -0,0 +1,9 @@ +File file = new File( basedir, "build.log" ); +assert file.exists(); + +String text = file.getText("utf-8"); + +assert !text.contains('define property propname-identity = "outofdate"') : "Erroneously defined property propname-identity = \"outofdate\"" +assert text.contains('define property propname-identity = "uptodate"') : "Failed to define property propname-identity = \"uptodate\"" + +return true; diff -Nru build-helper-maven-plugin-1.8/src/it/uptodate-merge/fixture.properties build-helper-maven-plugin-3.0.0/src/it/uptodate-merge/fixture.properties --- build-helper-maven-plugin-1.8/src/it/uptodate-merge/fixture.properties 1970-01-01 00:00:00.000000000 +0000 +++ build-helper-maven-plugin-3.0.0/src/it/uptodate-merge/fixture.properties 2017-01-29 19:58:46.000000000 +0000 @@ -0,0 +1,11 @@ +src/main/resources/source/dirA/fileAA.s = 1 +src/main/resources/source/dirA/fileAB.s = 2 +src/main/resources/source/dirA/fileAX.s = 3 +src/main/resources/source/dirB/fileBA.s = 4 +src/main/resources/source/dirB/fileBB.s = 5 +src/main/resources/source/dirB/fileBX.s = 6 +src/main/resources/source/dirY/fileYA.s = 7 +src/main/resources/source/dirY/fileYB.s = 8 +src/main/resources/source/dirY/fileYX.s = 9 + +src/main/resources/target/todir/outfile.t = 6 \ No newline at end of file diff -Nru build-helper-maven-plugin-1.8/src/it/uptodate-merge/invoker.properties build-helper-maven-plugin-3.0.0/src/it/uptodate-merge/invoker.properties --- build-helper-maven-plugin-1.8/src/it/uptodate-merge/invoker.properties 1970-01-01 00:00:00.000000000 +0000 +++ build-helper-maven-plugin-3.0.0/src/it/uptodate-merge/invoker.properties 2017-01-29 19:58:46.000000000 +0000 @@ -0,0 +1,2 @@ +invoker.goals = validate +#invoker.mavenOpts = -agentlib:jdwp=transport=dt_socket,server=y,suspend=y,address=8000 diff -Nru build-helper-maven-plugin-1.8/src/it/uptodate-merge/pom.xml build-helper-maven-plugin-3.0.0/src/it/uptodate-merge/pom.xml --- build-helper-maven-plugin-1.8/src/it/uptodate-merge/pom.xml 1970-01-01 00:00:00.000000000 +0000 +++ build-helper-maven-plugin-3.0.0/src/it/uptodate-merge/pom.xml 2017-01-29 19:58:46.000000000 +0000 @@ -0,0 +1,66 @@ + + 4.0.0 + + org.codehaus.mojo + build-helper-maven-plugin-uptodate-merge-it + 1-SNAPSHOT + jar + + UpToDate Merge + Tests that uptodate-property with merge mapping works + + + + + src/main/resources + + test.properties + + false + + + src/main/resources + + test.properties + + true + + + + + @project.groupId@ + @project.artifactId@ + @project.version@ + + + + uptodate-property + + + propname-merge + uptodate + outofdate + + src/main/resources/source + src/main/resources/target + + dir*/** + + + **/*X* + **/*Y/** + + + merge + file*.s + todir/outfile.t + + + + + + + + + + \ No newline at end of file diff -Nru build-helper-maven-plugin-1.8/src/it/uptodate-merge/prebuild.groovy build-helper-maven-plugin-3.0.0/src/it/uptodate-merge/prebuild.groovy --- build-helper-maven-plugin-1.8/src/it/uptodate-merge/prebuild.groovy 1970-01-01 00:00:00.000000000 +0000 +++ build-helper-maven-plugin-3.0.0/src/it/uptodate-merge/prebuild.groovy 2017-01-29 19:58:46.000000000 +0000 @@ -0,0 +1 @@ +org.codehaus.mojo.buildhelper.FixtureUtils.createResources( "target/it/uptodate-merge" ) \ No newline at end of file diff -Nru build-helper-maven-plugin-1.8/src/it/uptodate-merge/verify.groovy build-helper-maven-plugin-3.0.0/src/it/uptodate-merge/verify.groovy --- build-helper-maven-plugin-1.8/src/it/uptodate-merge/verify.groovy 1970-01-01 00:00:00.000000000 +0000 +++ build-helper-maven-plugin-3.0.0/src/it/uptodate-merge/verify.groovy 2017-01-29 19:58:46.000000000 +0000 @@ -0,0 +1,9 @@ +File file = new File( basedir, "build.log" ); +assert file.exists(); + +String text = file.getText("utf-8"); + +assert !text.contains('define property propname-merge = "outofdate"') : "Erroneously defined property propname-merge = \"outofdate\"" +assert text.contains('define property propname-merge = "uptodate"') : "Failed to define property propname-merge = \"uptodate\"" + +return true; diff -Nru build-helper-maven-plugin-1.8/src/it/uptodate-multi/fixture.properties build-helper-maven-plugin-3.0.0/src/it/uptodate-multi/fixture.properties --- build-helper-maven-plugin-1.8/src/it/uptodate-multi/fixture.properties 1970-01-01 00:00:00.000000000 +0000 +++ build-helper-maven-plugin-3.0.0/src/it/uptodate-multi/fixture.properties 2017-01-29 19:58:46.000000000 +0000 @@ -0,0 +1,51 @@ +src/main/resources/source/dirA/fileAA.s = 1 +src/main/resources/source/dirA/fileAB.s = 2 +src/main/resources/source/dirA/fileAX.s = 3 +src/main/resources/source/dirB/fileBA.s = 4 +src/main/resources/source/dirB/fileBB.s = 5 +src/main/resources/source/dirB/fileBX.s = 6 +src/main/resources/source/dirY/fileYA.s = 7 +src/main/resources/source/dirY/fileYB.s = 8 +src/main/resources/source/dirY/fileYX.s = 9 + +src/main/resources/source/unpackage/dirA.fileAA.s = 1 +src/main/resources/source/unpackage/dirA.fileAB.s = 2 +src/main/resources/source/unpackage/dirA.fileAX.s = 3 +src/main/resources/source/unpackage/dirB.fileBA.s = 4 +src/main/resources/source/unpackage/dirB.fileBB.s = 5 +src/main/resources/source/unpackage/dirB.fileBX.s = 6 +src/main/resources/source/unpackage/dirY.fileYA.s = 7 +src/main/resources/source/unpackage/dirY.fileYB.s = 8 +src/main/resources/source/unpackage/dirY.fileYX.s = 9 + +src/main/resources/target/flatten/fileAA.s = 1 +src/main/resources/target/flatten/fileAB.s = 3 +src/main/resources/target/flatten/fileAX.s = 0 +src/main/resources/target/flatten/fileBA.s = 5 +src/main/resources/target/flatten/fileBB.s = 6 + +src/main/resources/target/glob/dirA/fileAA.t = 1 +src/main/resources/target/glob/dirA/fileAB.t = 3 +src/main/resources/target/glob/dirA/fileAX.t = 0 +src/main/resources/target/glob/dirB/fileBA.t = 5 +src/main/resources/target/glob/dirB/fileBB.t = 6 + +src/main/resources/target/identity/dirA/fileAA.s = 1 +src/main/resources/target/identity/dirA/fileAB.s = 3 +src/main/resources/target/identity/dirA/fileAX.s = 0 +src/main/resources/target/identity/dirB/fileBA.s = 5 +src/main/resources/target/identity/dirB/fileBB.s = 6 + +src/main/resources/target/merge/todir/outfile.t = 6 + +src/main/resources/target/package/dirA.fileAA.t = 1 +src/main/resources/target/package/dirA.fileAB.t = 3 +src/main/resources/target/package/dirA.fileAX.t = 0 +src/main/resources/target/package/dirB.fileBA.t = 5 +src/main/resources/target/package/dirB.fileBB.t = 6 + +src/main/resources/target/unpackage/dirA/fileAA.t = 1 +src/main/resources/target/unpackage/dirA/fileAB.t = 3 +src/main/resources/target/unpackage/dirA/fileAX.t = 0 +src/main/resources/target/unpackage/dirB/fileBA.t = 5 +src/main/resources/target/unpackage/dirB/fileBB.t = 6 \ No newline at end of file diff -Nru build-helper-maven-plugin-1.8/src/it/uptodate-multi/invoker.properties build-helper-maven-plugin-3.0.0/src/it/uptodate-multi/invoker.properties --- build-helper-maven-plugin-1.8/src/it/uptodate-multi/invoker.properties 1970-01-01 00:00:00.000000000 +0000 +++ build-helper-maven-plugin-3.0.0/src/it/uptodate-multi/invoker.properties 2017-01-29 19:58:46.000000000 +0000 @@ -0,0 +1,2 @@ +invoker.goals = validate +#invoker.mavenOpts = -agentlib:jdwp=transport=dt_socket,server=y,suspend=y,address=8000 diff -Nru build-helper-maven-plugin-1.8/src/it/uptodate-multi/pom.xml build-helper-maven-plugin-3.0.0/src/it/uptodate-multi/pom.xml --- build-helper-maven-plugin-1.8/src/it/uptodate-multi/pom.xml 1970-01-01 00:00:00.000000000 +0000 +++ build-helper-maven-plugin-3.0.0/src/it/uptodate-multi/pom.xml 2017-01-29 19:58:46.000000000 +0000 @@ -0,0 +1,170 @@ + + 4.0.0 + + org.codehaus.mojo + build-helper-maven-plugin-uptodate-multi-it + 1-SNAPSHOT + jar + + UpToDate Multi + Tests that uptodate-properties works with various mappers + + + + + src/main/resources + + test.properties + + false + + + src/main/resources + + test.properties + + true + + + + + @project.groupId@ + @project.artifactId@ + @project.version@ + + + + uptodate-properties + + + + + propname-flatten + uptodate + outofdate + + src/main/resources/source + src/main/resources/target/flatten + + dir*/** + + + **/*X* + **/*Y/** + + + flatten + + + + + propname-glob + uptodate + outofdate + + src/main/resources/source + src/main/resources/target/glob + + dir*/** + + + **/*X* + **/*Y/** + + + glob + *.s + *.t + + + + + propname-identity + uptodate + outofdate + outofdate + + src/main/resources/source + src/main/resources/target/identity + + dir*/** + + + **/*X* + **/*Y/** + + + + + propname-merge + uptodate + outofdate + + src/main/resources/source + src/main/resources/target/merge + + dir*/** + + + **/*X* + **/*Y/** + + + merge + file*.s + todir/outfile.t + + + + + propname-package + uptodate + outofdate + + src/main/resources/source + src/main/resources/target/package + + dir*/** + + + **/*X* + **/*Y/** + + + package + *.s + *.t + + + + + propname-unpackage + uptodate + outofdate + + src/main/resources/source/unpackage + src/main/resources/target/unpackage + + dir*.s + + + *X* + *Y* + + + unpackage + *.s + *.t + + + + + + + + + + + + \ No newline at end of file diff -Nru build-helper-maven-plugin-1.8/src/it/uptodate-multi/prebuild.groovy build-helper-maven-plugin-3.0.0/src/it/uptodate-multi/prebuild.groovy --- build-helper-maven-plugin-1.8/src/it/uptodate-multi/prebuild.groovy 1970-01-01 00:00:00.000000000 +0000 +++ build-helper-maven-plugin-3.0.0/src/it/uptodate-multi/prebuild.groovy 2017-01-29 19:58:46.000000000 +0000 @@ -0,0 +1 @@ +org.codehaus.mojo.buildhelper.FixtureUtils.createResources( "target/it/uptodate-multi" ) \ No newline at end of file diff -Nru build-helper-maven-plugin-1.8/src/it/uptodate-multi/verify.groovy build-helper-maven-plugin-3.0.0/src/it/uptodate-multi/verify.groovy --- build-helper-maven-plugin-1.8/src/it/uptodate-multi/verify.groovy 1970-01-01 00:00:00.000000000 +0000 +++ build-helper-maven-plugin-3.0.0/src/it/uptodate-multi/verify.groovy 2017-01-29 19:58:46.000000000 +0000 @@ -0,0 +1,24 @@ +File file = new File( basedir, "build.log" ); +assert file.exists(); + +String text = file.getText("utf-8"); + +assert !text.contains('define property propname-flatten = "outofdate"') : "Erroneously defined property propname-flatten = \"outofdate\"" +assert text.contains('define property propname-flatten = "uptodate"') : "Failed to define property propname-flatten = \"uptodate\"" + +assert !text.contains('define property propname-glob = "outofdate"') : "Erroneously defined property propname-glob = \"outofdate\"" +assert text.contains('define property propname-glob = "uptodate"') : "Failed to define property propname-glob = \"uptodate\"" + +assert !text.contains('define property propname-identity = "outofdate"') : "Erroneously defined property propname-identity = \"outofdate\"" +assert text.contains('define property propname-identity = "uptodate"') : "Failed to define property propname-identity = \"uptodate\"" + +assert !text.contains('define property propname-merge = "outofdate"') : "Erroneously defined property propname-merge = \"outofdate\"" +assert text.contains('define property propname-merge = "uptodate"') : "Failed to define property propname-merge = \"uptodate\"" + +assert !text.contains('define property propname-package = "outofdate"') : "Erroneously defined property propname-package = \"outofdate\"" +assert text.contains('define property propname-package = "uptodate"') : "Failed to define property propname-package = \"uptodate\"" + +assert !text.contains('define property propname-unpackage = "outofdate"') : "Erroneously defined property propname-unpackage = \"outofdate\"" +assert text.contains('define property propname-unpackage = "uptodate"') : "Failed to define property propname-unpackage = \"uptodate\"" + +return true; diff -Nru build-helper-maven-plugin-1.8/src/it/uptodate-multi-negative/fixture.properties build-helper-maven-plugin-3.0.0/src/it/uptodate-multi-negative/fixture.properties --- build-helper-maven-plugin-1.8/src/it/uptodate-multi-negative/fixture.properties 1970-01-01 00:00:00.000000000 +0000 +++ build-helper-maven-plugin-3.0.0/src/it/uptodate-multi-negative/fixture.properties 2017-01-29 19:58:46.000000000 +0000 @@ -0,0 +1,55 @@ +src/main/resources/source/dirA/fileAA.s = 1 +src/main/resources/source/dirA/fileAB.s = 2 +src/main/resources/source/dirA/fileAX.s = 3 +src/main/resources/source/dirB/fileBA.s = 4 +src/main/resources/source/dirB/fileBB.s = 5 +src/main/resources/source/dirB/fileBX.s = 6 +src/main/resources/source/dirY/fileYA.s = 7 +src/main/resources/source/dirY/fileYB.s = 8 +src/main/resources/source/dirY/fileYX.s = 9 + +src/main/resources/source/unpackage/dirA.fileAA.s = 1 +src/main/resources/source/unpackage/dirA.fileAB.s = 2 +src/main/resources/source/unpackage/dirA.fileAX.s = 3 +src/main/resources/source/unpackage/dirB.fileBA.s = 4 +src/main/resources/source/unpackage/dirB.fileBB.s = 5 +src/main/resources/source/unpackage/dirB.fileBX.s = 6 +src/main/resources/source/unpackage/dirY.fileYA.s = 7 +src/main/resources/source/unpackage/dirY.fileYB.s = 8 +src/main/resources/source/unpackage/dirY.fileYX.s = 9 + +# The flatten, glob, identity and merge negative tests should fail because certain target files are older than source files. + +src/main/resources/target/flatten/fileAA.s = 1 +src/main/resources/target/flatten/fileAB.s = 1 +src/main/resources/target/flatten/fileAX.s = 0 +src/main/resources/target/flatten/fileBA.s = 3 +src/main/resources/target/flatten/fileBB.s = 6 + +src/main/resources/target/glob/dirA/fileAA.t = 1 +src/main/resources/target/glob/dirA/fileAB.t = 1 +src/main/resources/target/glob/dirA/fileAX.t = 0 +src/main/resources/target/glob/dirB/fileBA.t = 3 +src/main/resources/target/glob/dirB/fileBB.t = 6 + +src/main/resources/target/identity/dirA/fileAA.s = 1 +src/main/resources/target/identity/dirA/fileAB.s = 1 +src/main/resources/target/identity/dirA/fileAX.s = 0 +src/main/resources/target/identity/dirB/fileBA.s = 3 +src/main/resources/target/identity/dirB/fileBB.s = 6 + +src/main/resources/target/merge/todir/outfile.t = 3 + +# The package and unpackage negative tests should fail because certain target files are missing. + +#src/main/resources/target/package/dirA.fileAA.t = 1 +src/main/resources/target/package/dirA.fileAB.t = 3 +src/main/resources/target/package/dirA.fileAX.t = 0 +src/main/resources/target/package/dirB.fileBA.t = 5 +src/main/resources/target/package/dirB.fileBB.t = 6 + +src/main/resources/target/unpackage/dirA/fileAA.t = 1 +src/main/resources/target/unpackage/dirA/fileAB.t = 2 +src/main/resources/target/unpackage/dirA/fileAX.t = 0 +#src/main/resources/target/unpackage/dirB/fileBA.t = 5 +src/main/resources/target/unpackage/dirB/fileBB.t = 6 \ No newline at end of file diff -Nru build-helper-maven-plugin-1.8/src/it/uptodate-multi-negative/invoker.properties build-helper-maven-plugin-3.0.0/src/it/uptodate-multi-negative/invoker.properties --- build-helper-maven-plugin-1.8/src/it/uptodate-multi-negative/invoker.properties 1970-01-01 00:00:00.000000000 +0000 +++ build-helper-maven-plugin-3.0.0/src/it/uptodate-multi-negative/invoker.properties 2017-01-29 19:58:46.000000000 +0000 @@ -0,0 +1,2 @@ +invoker.goals = validate +#invoker.mavenOpts = -agentlib:jdwp=transport=dt_socket,server=y,suspend=y,address=8000 diff -Nru build-helper-maven-plugin-1.8/src/it/uptodate-multi-negative/pom.xml build-helper-maven-plugin-3.0.0/src/it/uptodate-multi-negative/pom.xml --- build-helper-maven-plugin-1.8/src/it/uptodate-multi-negative/pom.xml 1970-01-01 00:00:00.000000000 +0000 +++ build-helper-maven-plugin-3.0.0/src/it/uptodate-multi-negative/pom.xml 2017-01-29 19:58:46.000000000 +0000 @@ -0,0 +1,170 @@ + + 4.0.0 + + org.codehaus.mojo + build-helper-maven-plugin-uptodate-multi-negative-it + 1-SNAPSHOT + jar + + UpToDate Multi (negative) + Tests that uptodate-properties works with various mappers when target out of date WRT source + + + + + src/main/resources + + test.properties + + false + + + src/main/resources + + test.properties + + true + + + + + @project.groupId@ + @project.artifactId@ + @project.version@ + + + + uptodate-properties + + + + + propname-flatten + uptodate + outofdate + + src/main/resources/source + src/main/resources/target/flatten + + dir*/** + + + **/*X* + **/*Y/** + + + flatten + + + + + propname-glob + uptodate + outofdate + + src/main/resources/source + src/main/resources/target/glob + + dir*/** + + + **/*X* + **/*Y/** + + + glob + *.s + *.t + + + + + propname-identity + uptodate + outofdate + outofdate + + src/main/resources/source + src/main/resources/target/identity + + dir*/** + + + **/*X* + **/*Y/** + + + + + propname-merge + uptodate + outofdate + + src/main/resources/source + src/main/resources/target/merge + + dir*/** + + + **/*X* + **/*Y/** + + + merge + file*.s + todir/outfile.t + + + + + propname-package + uptodate + outofdate + + src/main/resources/source + src/main/resources/target/package + + dir*/** + + + **/*X* + **/*Y/** + + + package + *.s + *.t + + + + + propname-unpackage + uptodate + outofdate + + src/main/resources/source/unpackage + src/main/resources/target/unpackage + + dir*.s + + + *X* + *Y* + + + unpackage + *.s + *.t + + + + + + + + + + + + \ No newline at end of file diff -Nru build-helper-maven-plugin-1.8/src/it/uptodate-multi-negative/prebuild.groovy build-helper-maven-plugin-3.0.0/src/it/uptodate-multi-negative/prebuild.groovy --- build-helper-maven-plugin-1.8/src/it/uptodate-multi-negative/prebuild.groovy 1970-01-01 00:00:00.000000000 +0000 +++ build-helper-maven-plugin-3.0.0/src/it/uptodate-multi-negative/prebuild.groovy 2017-01-29 19:58:46.000000000 +0000 @@ -0,0 +1 @@ +org.codehaus.mojo.buildhelper.FixtureUtils.createResources( "target/it/uptodate-multi-negative" ) \ No newline at end of file diff -Nru build-helper-maven-plugin-1.8/src/it/uptodate-multi-negative/verify.groovy build-helper-maven-plugin-3.0.0/src/it/uptodate-multi-negative/verify.groovy --- build-helper-maven-plugin-1.8/src/it/uptodate-multi-negative/verify.groovy 1970-01-01 00:00:00.000000000 +0000 +++ build-helper-maven-plugin-3.0.0/src/it/uptodate-multi-negative/verify.groovy 2017-01-29 19:58:46.000000000 +0000 @@ -0,0 +1,24 @@ +File file = new File( basedir, "build.log" ); +assert file.exists(); + +String text = file.getText("utf-8"); + +assert text.contains('define property propname-flatten = "outofdate"') : "Failed to define property propname-flatten = \"outofdate\"" +assert !text.contains('define property propname-flatten = "uptodate"') : "Erroneously defined property propname-flatten = \"uptodate\"" + +assert text.contains('define property propname-glob = "outofdate"') : "Failed to define property propname-glob = \"outofdate\"" +assert !text.contains('define property propname-glob = "uptodate"') : "Erroneously defined property propname-glob = \"uptodate\"" + +assert text.contains('define property propname-identity = "outofdate"') : "Failed to define property propname-identity = \"outofdate\"" +assert !text.contains('define property propname-identity = "uptodate"') : "Erroneously defined property propname-identity = \"uptodate\"" + +assert text.contains('define property propname-merge = "outofdate"') : "Failed to define property propname-merge = \"outofdate\"" +assert !text.contains('define property propname-merge = "uptodate"') : "Erroneously defined property propname-merge = \"uptodate\"" + +assert text.contains('define property propname-package = "outofdate"') : "Failed to define property propname-package = \"outofdate\"" +assert !text.contains('define property propname-package = "uptodate"') : "Erroneously defined property propname-package = \"uptodate\"" + +assert text.contains('define property propname-unpackage = "outofdate"') : "Failed to define property propname-unpackage = \"outofdate\"" +assert !text.contains('define property propname-unpackage = "uptodate"') : "Erroneously defined property propname-unpackage = \"uptodate\"" + +return true; diff -Nru build-helper-maven-plugin-1.8/src/it/uptodate-package/fixture.properties build-helper-maven-plugin-3.0.0/src/it/uptodate-package/fixture.properties --- build-helper-maven-plugin-1.8/src/it/uptodate-package/fixture.properties 1970-01-01 00:00:00.000000000 +0000 +++ build-helper-maven-plugin-3.0.0/src/it/uptodate-package/fixture.properties 2017-01-29 19:58:46.000000000 +0000 @@ -0,0 +1,15 @@ +src/main/resources/source/dirA/fileAA.s = 1 +src/main/resources/source/dirA/fileAB.s = 2 +src/main/resources/source/dirA/fileAX.s = 3 +src/main/resources/source/dirB/fileBA.s = 4 +src/main/resources/source/dirB/fileBB.s = 5 +src/main/resources/source/dirB/fileBX.s = 6 +src/main/resources/source/dirY/fileYA.s = 7 +src/main/resources/source/dirY/fileYB.s = 8 +src/main/resources/source/dirY/fileYX.s = 9 + +src/main/resources/target/dirA.fileAA.t = 1 +src/main/resources/target/dirA.fileAB.t = 3 +src/main/resources/target/dirA.fileAX.t = 0 +src/main/resources/target/dirB.fileBA.t = 5 +src/main/resources/target/dirB.fileBB.t = 6 diff -Nru build-helper-maven-plugin-1.8/src/it/uptodate-package/invoker.properties build-helper-maven-plugin-3.0.0/src/it/uptodate-package/invoker.properties --- build-helper-maven-plugin-1.8/src/it/uptodate-package/invoker.properties 1970-01-01 00:00:00.000000000 +0000 +++ build-helper-maven-plugin-3.0.0/src/it/uptodate-package/invoker.properties 2017-01-29 19:58:46.000000000 +0000 @@ -0,0 +1,2 @@ +invoker.goals = validate +#invoker.mavenOpts = -agentlib:jdwp=transport=dt_socket,server=y,suspend=y,address=8000 diff -Nru build-helper-maven-plugin-1.8/src/it/uptodate-package/pom.xml build-helper-maven-plugin-3.0.0/src/it/uptodate-package/pom.xml --- build-helper-maven-plugin-1.8/src/it/uptodate-package/pom.xml 1970-01-01 00:00:00.000000000 +0000 +++ build-helper-maven-plugin-3.0.0/src/it/uptodate-package/pom.xml 2017-01-29 19:58:46.000000000 +0000 @@ -0,0 +1,66 @@ + + 4.0.0 + + org.codehaus.mojo + build-helper-maven-plugin-uptodate-package-it + 1-SNAPSHOT + jar + + UpToDate Package + Tests that uptodate-property with package mapping works + + + + + src/main/resources + + test.properties + + false + + + src/main/resources + + test.properties + + true + + + + + @project.groupId@ + @project.artifactId@ + @project.version@ + + + + uptodate-property + + + propname-package + uptodate + outofdate + + src/main/resources/source + src/main/resources/target + + dir*/** + + + **/*X* + **/*Y/** + + + package + *.s + *.t + + + + + + + + + + \ No newline at end of file diff -Nru build-helper-maven-plugin-1.8/src/it/uptodate-package/prebuild.groovy build-helper-maven-plugin-3.0.0/src/it/uptodate-package/prebuild.groovy --- build-helper-maven-plugin-1.8/src/it/uptodate-package/prebuild.groovy 1970-01-01 00:00:00.000000000 +0000 +++ build-helper-maven-plugin-3.0.0/src/it/uptodate-package/prebuild.groovy 2017-01-29 19:58:46.000000000 +0000 @@ -0,0 +1 @@ +org.codehaus.mojo.buildhelper.FixtureUtils.createResources( "target/it/uptodate-package" ) \ No newline at end of file diff -Nru build-helper-maven-plugin-1.8/src/it/uptodate-package/verify.groovy build-helper-maven-plugin-3.0.0/src/it/uptodate-package/verify.groovy --- build-helper-maven-plugin-1.8/src/it/uptodate-package/verify.groovy 1970-01-01 00:00:00.000000000 +0000 +++ build-helper-maven-plugin-3.0.0/src/it/uptodate-package/verify.groovy 2017-01-29 19:58:46.000000000 +0000 @@ -0,0 +1,9 @@ +File file = new File( basedir, "build.log" ); +assert file.exists(); + +String text = file.getText("utf-8"); + +assert !text.contains('define property propname-package = "outofdate"') : "Erroneously defined property propname-package = \"outofdate\"" +assert text.contains('define property propname-package = "uptodate"') : "Failed to define property propname-package = \"uptodate\"" + +return true; diff -Nru build-helper-maven-plugin-1.8/src/it/uptodate-unpackage/fixture.properties build-helper-maven-plugin-3.0.0/src/it/uptodate-unpackage/fixture.properties --- build-helper-maven-plugin-1.8/src/it/uptodate-unpackage/fixture.properties 1970-01-01 00:00:00.000000000 +0000 +++ build-helper-maven-plugin-3.0.0/src/it/uptodate-unpackage/fixture.properties 2017-01-29 19:58:46.000000000 +0000 @@ -0,0 +1,15 @@ +src/main/resources/source/dirA.fileAA.s = 1 +src/main/resources/source/dirA.fileAB.s = 2 +src/main/resources/source/dirA.fileAX.s = 3 +src/main/resources/source/dirB.fileBA.s = 4 +src/main/resources/source/dirB.fileBB.s = 5 +src/main/resources/source/dirB.fileBX.s = 6 +src/main/resources/source/dirY.fileYA.s = 7 +src/main/resources/source/dirY.fileYB.s = 8 +src/main/resources/source/dirY.fileYX.s = 9 + +src/main/resources/target/dirA/fileAA.t = 1 +src/main/resources/target/dirA/fileAB.t = 3 +src/main/resources/target/dirA/fileAX.t = 0 +src/main/resources/target/dirB/fileBA.t = 5 +src/main/resources/target/dirB/fileBB.t = 6 \ No newline at end of file diff -Nru build-helper-maven-plugin-1.8/src/it/uptodate-unpackage/invoker.properties build-helper-maven-plugin-3.0.0/src/it/uptodate-unpackage/invoker.properties --- build-helper-maven-plugin-1.8/src/it/uptodate-unpackage/invoker.properties 1970-01-01 00:00:00.000000000 +0000 +++ build-helper-maven-plugin-3.0.0/src/it/uptodate-unpackage/invoker.properties 2017-01-29 19:58:46.000000000 +0000 @@ -0,0 +1,2 @@ +invoker.goals = validate +#invoker.mavenOpts = -agentlib:jdwp=transport=dt_socket,server=y,suspend=y,address=8000 diff -Nru build-helper-maven-plugin-1.8/src/it/uptodate-unpackage/pom.xml build-helper-maven-plugin-3.0.0/src/it/uptodate-unpackage/pom.xml --- build-helper-maven-plugin-1.8/src/it/uptodate-unpackage/pom.xml 1970-01-01 00:00:00.000000000 +0000 +++ build-helper-maven-plugin-3.0.0/src/it/uptodate-unpackage/pom.xml 2017-01-29 19:58:46.000000000 +0000 @@ -0,0 +1,66 @@ + + 4.0.0 + + org.codehaus.mojo + build-helper-maven-plugin-uptodate-unpackage-it + 1-SNAPSHOT + jar + + UpToDate Unpackage + Tests that uptodate-property with unpackage mapping works + + + + + src/main/resources + + test.properties + + false + + + src/main/resources + + test.properties + + true + + + + + @project.groupId@ + @project.artifactId@ + @project.version@ + + + + uptodate-property + + + propname-unpackage + uptodate + outofdate + + src/main/resources/source + src/main/resources/target + + dir*.s + + + *X* + *Y* + + + unpackage + *.s + *.t + + + + + + + + + + \ No newline at end of file diff -Nru build-helper-maven-plugin-1.8/src/it/uptodate-unpackage/prebuild.groovy build-helper-maven-plugin-3.0.0/src/it/uptodate-unpackage/prebuild.groovy --- build-helper-maven-plugin-1.8/src/it/uptodate-unpackage/prebuild.groovy 1970-01-01 00:00:00.000000000 +0000 +++ build-helper-maven-plugin-3.0.0/src/it/uptodate-unpackage/prebuild.groovy 2017-01-29 19:58:46.000000000 +0000 @@ -0,0 +1 @@ +org.codehaus.mojo.buildhelper.FixtureUtils.createResources( "target/it/uptodate-unpackage" ) \ No newline at end of file diff -Nru build-helper-maven-plugin-1.8/src/it/uptodate-unpackage/verify.groovy build-helper-maven-plugin-3.0.0/src/it/uptodate-unpackage/verify.groovy --- build-helper-maven-plugin-1.8/src/it/uptodate-unpackage/verify.groovy 1970-01-01 00:00:00.000000000 +0000 +++ build-helper-maven-plugin-3.0.0/src/it/uptodate-unpackage/verify.groovy 2017-01-29 19:58:46.000000000 +0000 @@ -0,0 +1,9 @@ +File file = new File( basedir, "build.log" ); +assert file.exists(); + +String text = file.getText("utf-8"); + +assert !text.contains('define property propname-unpackage = "outofdate"') : "Erroneously defined property propname-unpackage = \"outofdate\"" +assert text.contains('define property propname-unpackage = "uptodate"') : "Failed to define property propname-unpackage = \"uptodate\"" + +return true; diff -Nru build-helper-maven-plugin-1.8/src/main/java/org/codehaus/mojo/buildhelper/AbstractAddResourceMojo.java build-helper-maven-plugin-3.0.0/src/main/java/org/codehaus/mojo/buildhelper/AbstractAddResourceMojo.java --- build-helper-maven-plugin-1.8/src/main/java/org/codehaus/mojo/buildhelper/AbstractAddResourceMojo.java 2012-12-20 09:05:40.000000000 +0000 +++ build-helper-maven-plugin-3.0.0/src/main/java/org/codehaus/mojo/buildhelper/AbstractAddResourceMojo.java 2017-01-29 19:58:46.000000000 +0000 @@ -28,12 +28,11 @@ import org.apache.maven.model.Resource; import org.apache.maven.plugin.AbstractMojo; -import org.apache.maven.plugins.annotations.Component; import org.apache.maven.plugins.annotations.Parameter; import org.apache.maven.project.MavenProject; /** - * Abstract Mojo for adding Resources + * Abstract Mojo for adding Resources */ public abstract class AbstractAddResourceMojo extends AbstractMojo @@ -47,14 +46,14 @@ /** * The maven project */ - @Component + @Parameter( readonly = true, defaultValue = "${project}" ) private MavenProject project; /** * Main plugin execution */ public void execute() - { + { for ( Resource resource : resources ) { // Check for relative paths in the resource configuration. @@ -65,21 +64,21 @@ resourceDir = new File( project.getBasedir(), resource.getDirectory() ); resource.setDirectory( resourceDir.getAbsolutePath() ); } - + addResource( resource ); } } - + /** * Add the resource to the project. - * + * * @param resource the resource to add */ public abstract void addResource( Resource resource ); - + /** - * Get the current project instance. - * + * Get the current project instance. + * * @return the project */ public MavenProject getProject() diff -Nru build-helper-maven-plugin-1.8/src/main/java/org/codehaus/mojo/buildhelper/AbstractDefinePropertyMojo.java build-helper-maven-plugin-3.0.0/src/main/java/org/codehaus/mojo/buildhelper/AbstractDefinePropertyMojo.java --- build-helper-maven-plugin-1.8/src/main/java/org/codehaus/mojo/buildhelper/AbstractDefinePropertyMojo.java 2012-09-23 23:02:45.000000000 +0000 +++ build-helper-maven-plugin-3.0.0/src/main/java/org/codehaus/mojo/buildhelper/AbstractDefinePropertyMojo.java 2017-01-29 19:58:46.000000000 +0000 @@ -25,7 +25,7 @@ */ import org.apache.maven.plugin.AbstractMojo; -import org.apache.maven.plugins.annotations.Component; +import org.apache.maven.plugins.annotations.Parameter; import org.apache.maven.project.MavenProject; public abstract class AbstractDefinePropertyMojo @@ -34,7 +34,7 @@ /** * The maven project */ - @Component + @Parameter( readonly = true, defaultValue = "${project}" ) private MavenProject project; protected void defineProperty( String name, String value ) @@ -46,10 +46,10 @@ project.getProperties().put( name, value ); } - + /** - * Get the current project instance. - * + * Get the current project instance. + * * @return the project */ public MavenProject getProject() diff -Nru build-helper-maven-plugin-1.8/src/main/java/org/codehaus/mojo/buildhelper/AbstractRegexPropertyMojo.java build-helper-maven-plugin-3.0.0/src/main/java/org/codehaus/mojo/buildhelper/AbstractRegexPropertyMojo.java --- build-helper-maven-plugin-1.8/src/main/java/org/codehaus/mojo/buildhelper/AbstractRegexPropertyMojo.java 1970-01-01 00:00:00.000000000 +0000 +++ build-helper-maven-plugin-3.0.0/src/main/java/org/codehaus/mojo/buildhelper/AbstractRegexPropertyMojo.java 2017-01-29 19:58:46.000000000 +0000 @@ -0,0 +1,97 @@ +package org.codehaus.mojo.buildhelper; + +import java.util.Locale; + +/* + * The MIT License + * + * Copyright (c) 2004, The Codehaus + * + * 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. + */ + +import java.util.regex.Matcher; +import java.util.regex.Pattern; +import java.util.regex.PatternSyntaxException; + +import org.apache.maven.plugin.MojoExecutionException; +import org.apache.maven.plugin.MojoFailureException; +import org.codehaus.plexus.util.StringUtils; + +public abstract class AbstractRegexPropertyMojo + extends AbstractDefinePropertyMojo +{ + + protected void execute( RegexPropertySetting config ) + throws MojoExecutionException, MojoFailureException + { + try + { + config.validate(); + } + catch ( IllegalArgumentException e ) + { + throw new MojoExecutionException( e.getMessage(), e ); + } + + Pattern pattern; + try + { + pattern = Pattern.compile( config.getRegex() ); + } + catch ( PatternSyntaxException e ) + { + throw new MojoExecutionException( e.getMessage(), e ); + } + Matcher matcher = pattern.matcher( config.getValue() ); + + if ( matcher.find() ) + { + // if the string replacement is empty, we define the value replacement to empty. + config.setValue( ( StringUtils.isNotEmpty( config.getReplacement() ) + ? matcher.replaceAll( config.getReplacement() ) : matcher.replaceAll( "" ) ) ); + } + else + { + if ( config.isFailIfNoMatch() ) + { + throw new MojoFailureException( "No match to regex '" + config.getRegex() + "' found in '" + + config.getValue() + "'." ); + } + else + { + getLog().info( "No match to regex '" + config.getRegex() + "' found in '" + config.getValue() + "'. " + + "The initial value '" + config.getValue() + "' is left as-is..." ); + } + } + + if ( config.isToLowerCase() ) + { + config.setValue( config.getValue().toLowerCase( Locale.getDefault() ) ); + } + + if ( config.isToUpperCase() ) + { + config.setValue( config.getValue().toUpperCase( Locale.getDefault() ) ); + } + + defineProperty( config.getName(), config.getValue() ); + + } +} diff -Nru build-helper-maven-plugin-1.8/src/main/java/org/codehaus/mojo/buildhelper/AbstractUpToDatePropertyMojo.java build-helper-maven-plugin-3.0.0/src/main/java/org/codehaus/mojo/buildhelper/AbstractUpToDatePropertyMojo.java --- build-helper-maven-plugin-1.8/src/main/java/org/codehaus/mojo/buildhelper/AbstractUpToDatePropertyMojo.java 1970-01-01 00:00:00.000000000 +0000 +++ build-helper-maven-plugin-3.0.0/src/main/java/org/codehaus/mojo/buildhelper/AbstractUpToDatePropertyMojo.java 2017-01-29 19:58:46.000000000 +0000 @@ -0,0 +1,129 @@ +package org.codehaus.mojo.buildhelper; + +/* + * The MIT License + * + * Copyright (c) 2004, The Codehaus + * + * 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. + */ + +import java.io.File; +import java.io.IOException; +import java.util.Map; +import java.util.Map.Entry; + +import org.apache.maven.plugin.MojoExecutionException; +import org.apache.maven.plugin.MojoFailureException; +import org.apache.maven.shared.model.fileset.FileSet; +import org.apache.maven.shared.model.fileset.mappers.MapperException; +import org.apache.maven.shared.model.fileset.util.FileSetManager; +import org.codehaus.plexus.util.StringUtils; + +/** + * Abstract base for setting properties according to whether sets of source and object resources are respectively up to + * date with each other. + * + * @author Adrian Price demonfiddler@virginmedia.com + * @since 1.12 + */ +abstract class AbstractUpToDatePropertyMojo + extends AbstractDefinePropertyMojo +{ + protected AbstractUpToDatePropertyMojo() + { + } + + protected void execute( UpToDatePropertySetting config ) + throws MojoExecutionException, MojoFailureException + { + try + { + config.validate(); + } + catch ( IllegalArgumentException e ) + { + throw new MojoExecutionException( "Invalid UpToDateProperty configuration", e ); + } + + // Check that all target file(s) are up to date with respect to their corresponding source files. + boolean upToDate = true; + FileSet fileSet = config.getFileSet(); + if ( fileSet != null ) + { + try + { + FileSetManager fileSetManager = new FileSetManager( getLog() ); + Map includedFiles = fileSetManager.mapIncludedFiles( fileSet ); + + // Treat a file set that yields no files as intrinsically out of date. + upToDate = !includedFiles.isEmpty(); + + for ( Entry entry : includedFiles.entrySet() ) + { + // If targetFile is out of date WRT srcFile, note the fact and stop processing. + File srcFile = getFile( fileSet, false, entry.getKey() ); + File targetFile = getFile( fileSet, true, entry.getValue() ); + upToDate = isUpToDate( srcFile, targetFile ); + + if ( getLog().isDebugEnabled() ) + { + try + { + StringBuilder msg = new StringBuilder( targetFile.getCanonicalPath() ); + if ( !targetFile.exists() ) + msg.append( " (nonexistent)" ); + msg.append( "\n\tis " ).append( upToDate ? "up to date" + : "out of date" ).append( " with respect to \n\t" ).append( srcFile.getCanonicalPath() ); + if ( !srcFile.exists() ) + msg.append( " (nonexistent)" ); + + getLog().debug( msg ); + } + catch ( IOException e ) + { + // Just a log entry so not fatal. + } + } + + if ( !upToDate ) + break; + } + } + catch ( MapperException e ) + { + throw new MojoExecutionException( "", e ); + } + } + + // Set the property to the appropriate value, depending on whether target files are up to date WRT source files. + if ( upToDate ) + defineProperty( config.getName(), config.getValue().trim() ); + else if ( !StringUtils.isBlank( config.getElse() ) ) + defineProperty( config.getName(), config.getElse().trim() ); + } + + private File getFile( FileSet fileSet, boolean useOutputDirectory, String path ) + { + String baseDir = useOutputDirectory && !StringUtils.isBlank( fileSet.getOutputDirectory() ) + ? fileSet.getOutputDirectory() : fileSet.getDirectory(); + return path == null ? null : new File( baseDir, path ); + } + + private boolean isUpToDate( File srcFile, File targetFile ) + { + return srcFile != null && srcFile.exists() + && ( targetFile == null || srcFile.lastModified() <= targetFile.lastModified() ); + } +} diff -Nru build-helper-maven-plugin-1.8/src/main/java/org/codehaus/mojo/buildhelper/AddResourceMojo.java build-helper-maven-plugin-3.0.0/src/main/java/org/codehaus/mojo/buildhelper/AddResourceMojo.java --- build-helper-maven-plugin-1.8/src/main/java/org/codehaus/mojo/buildhelper/AddResourceMojo.java 2012-09-22 20:27:21.000000000 +0000 +++ build-helper-maven-plugin-3.0.0/src/main/java/org/codehaus/mojo/buildhelper/AddResourceMojo.java 2017-01-29 19:58:46.000000000 +0000 @@ -32,7 +32,7 @@ * Add more resource directories to the POM. * * @author Paul Gier - * @version $Id: AddResourceMojo.java 17586 2012-09-22 20:27:21Z hboutemy $ + * @version $Id$ * @since 1.3 */ @Mojo( name = "add-resource", defaultPhase = LifecyclePhase.GENERATE_RESOURCES, threadSafe = true ) @@ -45,7 +45,7 @@ getProject().addResource( resource ); if ( getLog().isDebugEnabled() ) { - getLog().debug( "Added resource: " + resource.getDirectory() ); + getLog().debug( "Added resource: " + resource.getDirectory() ); } } } diff -Nru build-helper-maven-plugin-1.8/src/main/java/org/codehaus/mojo/buildhelper/AddSourceMojo.java build-helper-maven-plugin-3.0.0/src/main/java/org/codehaus/mojo/buildhelper/AddSourceMojo.java --- build-helper-maven-plugin-1.8/src/main/java/org/codehaus/mojo/buildhelper/AddSourceMojo.java 2012-09-22 20:27:21.000000000 +0000 +++ build-helper-maven-plugin-3.0.0/src/main/java/org/codehaus/mojo/buildhelper/AddSourceMojo.java 2017-01-29 19:58:46.000000000 +0000 @@ -27,7 +27,6 @@ import java.io.File; import org.apache.maven.plugin.AbstractMojo; -import org.apache.maven.plugins.annotations.Component; import org.apache.maven.plugins.annotations.LifecyclePhase; import org.apache.maven.plugins.annotations.Mojo; import org.apache.maven.plugins.annotations.Parameter; @@ -37,7 +36,7 @@ * Add more source directories to the POM. * * @author Dan T. Tran - * @version $Id: AddSourceMojo.java 17586 2012-09-22 20:27:21Z hboutemy $ + * @version $Id$ * @since 1.0 */ @Mojo( name = "add-source", defaultPhase = LifecyclePhase.GENERATE_SOURCES, threadSafe = true ) @@ -55,17 +54,17 @@ /** * @since 1.0 */ - @Component + @Parameter( readonly = true, defaultValue = "${project}" ) private MavenProject project; public void execute() - { + { for ( File source : sources ) { this.project.addCompileSourceRoot( source.getAbsolutePath() ); - if( getLog().isInfoEnabled() ) + if ( getLog().isInfoEnabled() ) { - getLog().info( "Source directory: " + source + " added." ); + getLog().info( "Source directory: " + source + " added." ); } } } diff -Nru build-helper-maven-plugin-1.8/src/main/java/org/codehaus/mojo/buildhelper/AddTestResourceMojo.java build-helper-maven-plugin-3.0.0/src/main/java/org/codehaus/mojo/buildhelper/AddTestResourceMojo.java --- build-helper-maven-plugin-1.8/src/main/java/org/codehaus/mojo/buildhelper/AddTestResourceMojo.java 2012-09-22 20:27:21.000000000 +0000 +++ build-helper-maven-plugin-3.0.0/src/main/java/org/codehaus/mojo/buildhelper/AddTestResourceMojo.java 2017-01-29 19:58:46.000000000 +0000 @@ -32,7 +32,7 @@ * Add more test resource directories to the POM. * * @author Paul Gier - * @version $Id: AddTestResourceMojo.java 17586 2012-09-22 20:27:21Z hboutemy $ + * @version $Id$ * @since 1.3 */ @Mojo( name = "add-test-resource", defaultPhase = LifecyclePhase.GENERATE_TEST_RESOURCES, threadSafe = true ) @@ -40,12 +40,17 @@ extends AbstractAddResourceMojo { + /** + * Add the resource to the project. + * + * @param resource the resource to add + */ public void addResource( Resource resource ) { getProject().addTestResource( resource ); if ( getLog().isDebugEnabled() ) { - getLog().debug( "Added test resource: " + resource.getDirectory() ); + getLog().debug( "Added test resource: " + resource.getDirectory() ); } } } diff -Nru build-helper-maven-plugin-1.8/src/main/java/org/codehaus/mojo/buildhelper/AddTestSourceMojo.java build-helper-maven-plugin-3.0.0/src/main/java/org/codehaus/mojo/buildhelper/AddTestSourceMojo.java --- build-helper-maven-plugin-1.8/src/main/java/org/codehaus/mojo/buildhelper/AddTestSourceMojo.java 2012-09-22 20:27:21.000000000 +0000 +++ build-helper-maven-plugin-3.0.0/src/main/java/org/codehaus/mojo/buildhelper/AddTestSourceMojo.java 2017-01-29 19:58:46.000000000 +0000 @@ -27,7 +27,6 @@ import java.io.File; import org.apache.maven.plugin.AbstractMojo; -import org.apache.maven.plugins.annotations.Component; import org.apache.maven.plugins.annotations.LifecyclePhase; import org.apache.maven.plugins.annotations.Mojo; import org.apache.maven.plugins.annotations.Parameter; @@ -37,7 +36,7 @@ * Add test source directories to the POM. * * @author Dan T. Tran - * @version $Id: AddTestSourceMojo.java 17586 2012-09-22 20:27:21Z hboutemy $ + * @version $Id$ * @since 1.0 */ @Mojo( name = "add-test-source", defaultPhase = LifecyclePhase.GENERATE_TEST_SOURCES, threadSafe = true ) @@ -55,17 +54,17 @@ /** * @since 1.0 */ - @Component + @Parameter( readonly = true, defaultValue = "${project}" ) private MavenProject project; public void execute() - { + { for ( File source : sources ) { this.project.addTestCompileSourceRoot( source.getAbsolutePath() ); if ( getLog().isInfoEnabled() ) { - getLog().info( "Test Source directory: " + source + " added." ); + getLog().info( "Test Source directory: " + source + " added." ); } } } diff -Nru build-helper-maven-plugin-1.8/src/main/java/org/codehaus/mojo/buildhelper/Artifact.java build-helper-maven-plugin-3.0.0/src/main/java/org/codehaus/mojo/buildhelper/Artifact.java --- build-helper-maven-plugin-1.8/src/main/java/org/codehaus/mojo/buildhelper/Artifact.java 2011-06-21 21:49:10.000000000 +0000 +++ build-helper-maven-plugin-3.0.0/src/main/java/org/codehaus/mojo/buildhelper/Artifact.java 2017-01-29 19:58:46.000000000 +0000 @@ -27,21 +27,25 @@ import java.io.File; /** - *

Artifact class.

+ *

+ * Artifact class. + *

* * @author dtran - * @version $Id: Artifact.java 14209 2011-06-21 21:49:10Z rfscholte $ + * @version $Id$ */ public class Artifact { private File file; - + private String type = "jar"; - + private String classifier; - + /** - *

Setter for the field file.

+ *

+ * Setter for the field file. + *

* * @param localFile a {@link java.io.File} object. */ @@ -49,19 +53,23 @@ { this.file = localFile; } - + /** - *

Getter for the field file.

+ *

+ * Getter for the field file. + *

* * @return a {@link java.io.File} object. */ - public File getFile () + public File getFile() { return this.file; } /** - *

Setter for the field type.

+ *

+ * Setter for the field type. + *

* * @param type a {@link java.lang.String} object. */ @@ -69,19 +77,23 @@ { this.type = type; } - + /** - *

Getter for the field type.

+ *

+ * Getter for the field type. + *

* * @return a {@link java.lang.String} object. */ - public String getType () + public String getType() { return this.type; - } - + } + /** - *

Setter for the field classifier.

+ *

+ * Setter for the field classifier. + *

* * @param classifier a {@link java.lang.String} object. */ @@ -89,14 +101,16 @@ { this.classifier = classifier; } - + /** - *

Getter for the field classifier.

+ *

+ * Getter for the field classifier. + *

* * @return a {@link java.lang.String} object. */ - public String getClassifier () + public String getClassifier() { return this.classifier; - } + } } diff -Nru build-helper-maven-plugin-1.8/src/main/java/org/codehaus/mojo/buildhelper/AttachArtifactMojo.java build-helper-maven-plugin-3.0.0/src/main/java/org/codehaus/mojo/buildhelper/AttachArtifactMojo.java --- build-helper-maven-plugin-1.8/src/main/java/org/codehaus/mojo/buildhelper/AttachArtifactMojo.java 2012-09-22 20:42:37.000000000 +0000 +++ build-helper-maven-plugin-3.0.0/src/main/java/org/codehaus/mojo/buildhelper/AttachArtifactMojo.java 2017-01-29 19:58:46.000000000 +0000 @@ -24,6 +24,9 @@ * SOFTWARE. */ +import java.util.HashSet; +import java.util.Set; + import org.apache.maven.execution.MavenSession; import org.apache.maven.plugin.AbstractMojo; import org.apache.maven.plugin.MojoExecutionException; @@ -35,14 +38,11 @@ import org.apache.maven.project.MavenProject; import org.apache.maven.project.MavenProjectHelper; -import java.util.HashSet; -import java.util.Set; - /** * Attach additional artifacts to be installed and deployed. * * @author Dan T. Tran - * @version $Id: AttachArtifactMojo.java 17587 2012-09-22 20:42:37Z hboutemy $ + * @version $Id$ * @since 1.0 */ @Mojo( name = "attach-artifact", defaultPhase = LifecyclePhase.PACKAGE, threadSafe = true ) @@ -53,7 +53,7 @@ * Attach an array of artifacts to the project. */ @Parameter( required = true ) - private Artifact [] artifacts; + private Artifact[] artifacts; /** * This project's base directory. @@ -68,10 +68,10 @@ * * @since 1.5 */ - @Component + @Parameter( readonly = true, defaultValue = "${session}" ) private MavenSession mavenSession; - @Component + @Parameter( readonly = true, defaultValue = "${project}" ) private MavenProject project; /** @@ -81,9 +81,8 @@ private MavenProjectHelper projectHelper; /** - * This will cause the execution to be run only at the top of a given module - * tree. That is, run in the project contained in the same folder where the - * mvn execution was launched. + * This will cause the execution to be run only at the top of a given module tree. That is, run in the project + * contained in the same folder where the mvn execution was launched. * * @since 1.5 */ @@ -91,14 +90,14 @@ private boolean runOnlyAtExecutionRoot; /** - * This allows to skip the attach execution in case it is known that the corresponding file does not exists. - * For exemple, when the previous ant-run task is skipped with a unless. - * + * This allows to skip the attach execution in case it is known that the corresponding file does not exists. For + * exemple, when the previous ant-run task is skipped with a unless. + * * @since 1.6 */ @Parameter( property = "buildhelper.skipAttach", defaultValue = "false" ) private boolean skipAttach; - + public void execute() throws MojoExecutionException, MojoFailureException { @@ -108,9 +107,9 @@ getLog().info( "Skip attaching artifacts" ); return; } - + // Run only at the execution root - if ( runOnlyAtExecutionRoot && !isThisTheExecutionRoot() ) + if ( runOnlyAtExecutionRoot && !project.isExecutionRoot() ) { getLog().info( "Skip attaching artifacts in this project because it's not the Execution Root" ); } @@ -120,44 +119,13 @@ for ( Artifact artifact : artifacts ) { - projectHelper.attachArtifact( this.project, - artifact.getType(), - artifact.getClassifier(), + projectHelper.attachArtifact( this.project, artifact.getType(), artifact.getClassifier(), artifact.getFile() ); } } } - /** - * Returns true if the current project is located at the - * Execution Root Directory (where mvn was launched). - * - * @return true if the current project is at the Execution Root - */ - private boolean isThisTheExecutionRoot() - { - if ( getLog().isDebugEnabled() ) - { - getLog().debug( "Root Folder:" + mavenSession.getExecutionRootDirectory() ); - getLog().debug( "Current Folder:" + basedir ); - - } - boolean result = mavenSession.getExecutionRootDirectory().equalsIgnoreCase( basedir.toString() ); - if ( getLog().isDebugEnabled() ) - { - if ( result ) - { - getLog().debug( "This is the execution root." ); - } - else - { - getLog().debug( "This is NOT the execution root." ); - } - } - return result; - } - private void validateArtifacts() throws MojoFailureException { @@ -169,8 +137,8 @@ if ( !extensionClassifiers.add( extensionClassifier ) ) { - throw new MojoFailureException( "The artifact with same type and classifier: " - + extensionClassifier + " is used more than once." ); + throw new MojoFailureException( "The artifact with same type and classifier: " + extensionClassifier + + " is used more than once." ); } } } diff -Nru build-helper-maven-plugin-1.8/src/main/java/org/codehaus/mojo/buildhelper/BeanshellPropertyMojo.java build-helper-maven-plugin-3.0.0/src/main/java/org/codehaus/mojo/buildhelper/BeanshellPropertyMojo.java --- build-helper-maven-plugin-1.8/src/main/java/org/codehaus/mojo/buildhelper/BeanshellPropertyMojo.java 2012-09-23 23:18:46.000000000 +0000 +++ build-helper-maven-plugin-3.0.0/src/main/java/org/codehaus/mojo/buildhelper/BeanshellPropertyMojo.java 2017-01-29 19:58:46.000000000 +0000 @@ -26,7 +26,6 @@ import org.apache.maven.execution.MavenSession; import org.apache.maven.plugin.MojoFailureException; -import org.apache.maven.plugins.annotations.Component; import org.apache.maven.plugins.annotations.LifecyclePhase; import org.apache.maven.plugins.annotations.Mojo; import org.apache.maven.plugins.annotations.Parameter; @@ -36,9 +35,10 @@ import bsh.Interpreter; /** - * Define one or many properties as a result of a Beanshell script invocation. - * Like gmaven-plugin, - * some variables are defined:
    + * Define one or many properties as a result of a Beanshell script invocation. Like + * gmaven-plugin, some variables are + * defined: + *
      *
    • project: the actual Maven project,
    • *
    • session: the executing MavenSession,
    • *
    • settings: the executing Settings.
    • @@ -55,8 +55,8 @@ private String source; /** - * List of property names to get from script context after execution. Can be omitted - * if no property needs to be defined, just the script execution. + * List of property names to get from script context after execution. Can be omitted if no property needs to be + * defined, just the script execution. */ @Parameter private String[] properties; @@ -64,13 +64,13 @@ /** * The Maven Session. */ - @Component + @Parameter( readonly = true, defaultValue = "${session}" ) private MavenSession mavenSession; /** * The Maven Settings. */ - @Component + @Parameter( readonly = true, defaultValue = "${settings}" ) private Settings settings; /** @@ -91,7 +91,8 @@ } catch ( EvalError ee ) { - MojoFailureException mfe = new MojoFailureException( "error during Beanshell script execution: " + ee.getMessage() ); + MojoFailureException mfe = + new MojoFailureException( "error during Beanshell script execution: " + ee.getMessage() ); mfe.initCause( ee ); throw mfe; } @@ -112,9 +113,8 @@ } catch ( EvalError ee ) { - MojoFailureException mfe = - new MojoFailureException( "cannot get Beanshell global variable '" + property + "': " - + ee.getMessage() ); + MojoFailureException mfe = new MojoFailureException( "cannot get Beanshell global variable '" + + property + "': " + ee.getMessage() ); mfe.initCause( ee ); throw mfe; } @@ -131,8 +131,8 @@ } catch ( EvalError ee ) { - MojoFailureException mfe = - new MojoFailureException( "cannot define Beanshell global variable '" + name + "': " + ee.getMessage() ); + MojoFailureException mfe = new MojoFailureException( "cannot define Beanshell global variable '" + name + + "': " + ee.getMessage() ); mfe.initCause( ee ); throw mfe; } diff -Nru build-helper-maven-plugin-1.8/src/main/java/org/codehaus/mojo/buildhelper/CpuCountMojo.java build-helper-maven-plugin-3.0.0/src/main/java/org/codehaus/mojo/buildhelper/CpuCountMojo.java --- build-helper-maven-plugin-1.8/src/main/java/org/codehaus/mojo/buildhelper/CpuCountMojo.java 1970-01-01 00:00:00.000000000 +0000 +++ build-helper-maven-plugin-3.0.0/src/main/java/org/codehaus/mojo/buildhelper/CpuCountMojo.java 2017-01-29 19:58:46.000000000 +0000 @@ -0,0 +1,67 @@ +package org.codehaus.mojo.buildhelper; + +/* + * The MIT License + * + * Copyright (c) 2004, The Codehaus + * + * 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. + */ + +import org.apache.maven.plugin.MojoExecutionException; +import org.apache.maven.plugins.annotations.LifecyclePhase; +import org.apache.maven.plugins.annotations.Mojo; +import org.apache.maven.plugins.annotations.Parameter; + +/** + * Retrieve number of CPUs with project factor, and place it under a configurable project property + * + * @author Dan T. Tran + * @since 1.9 + */ +@Mojo( name = "cpu-count", defaultPhase = LifecyclePhase.INITIALIZE, threadSafe = true ) +public class CpuCountMojo + extends AbstractDefinePropertyMojo +{ + + /** + * The name of the property in which to store the CPU count. + */ + @Parameter( defaultValue = "cpu.count" ) + private String cpuCount; + + /** + * Projection factor. + */ + @Parameter( defaultValue = "1.0" ) + private float factor; + + public void execute() + throws MojoExecutionException + { + float count = Runtime.getRuntime().availableProcessors() * factor; + if ( count < 1 ) + { + count = 1; + } + + defineProperty( this.cpuCount, Integer.toString( (int) count ) ); + this.getLog().info( "CPU count: " + this.getProject().getProperties().getProperty( cpuCount ) ); + } +} diff -Nru build-helper-maven-plugin-1.8/src/main/java/org/codehaus/mojo/buildhelper/LocalIpMojo.java build-helper-maven-plugin-3.0.0/src/main/java/org/codehaus/mojo/buildhelper/LocalIpMojo.java --- build-helper-maven-plugin-1.8/src/main/java/org/codehaus/mojo/buildhelper/LocalIpMojo.java 2012-09-23 10:08:45.000000000 +0000 +++ build-helper-maven-plugin-3.0.0/src/main/java/org/codehaus/mojo/buildhelper/LocalIpMojo.java 2017-01-29 19:58:46.000000000 +0000 @@ -2,21 +2,26 @@ /* * The MIT License - * + * * Copyright (c) 2004, The Codehaus - * - * 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. + * + * 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. */ import java.net.InetAddress; @@ -29,7 +34,7 @@ /** * Retrieve current host IP address and place it under a configurable project property - * + * * @author Dan T. Tran * @since 1.8 */ @@ -39,7 +44,7 @@ { /** - * The name of the property in which to store the version of maven. + * The name of the property in which to store the localhost ipaddress. */ @Parameter( defaultValue = "local.ip" ) private String localIpProperty; diff -Nru build-helper-maven-plugin-1.8/src/main/java/org/codehaus/mojo/buildhelper/MavenVersionMojo.java build-helper-maven-plugin-3.0.0/src/main/java/org/codehaus/mojo/buildhelper/MavenVersionMojo.java --- build-helper-maven-plugin-1.8/src/main/java/org/codehaus/mojo/buildhelper/MavenVersionMojo.java 2012-09-23 10:08:45.000000000 +0000 +++ build-helper-maven-plugin-3.0.0/src/main/java/org/codehaus/mojo/buildhelper/MavenVersionMojo.java 2017-01-29 19:58:46.000000000 +0000 @@ -33,7 +33,7 @@ /** * Store the maven core version in a property maven.version. - * + * * @author pgier * @since 1.3 */ @@ -56,7 +56,6 @@ /** * Main plugin execution - * */ public void execute() { diff -Nru build-helper-maven-plugin-1.8/src/main/java/org/codehaus/mojo/buildhelper/OsgiArtifactVersion.java build-helper-maven-plugin-3.0.0/src/main/java/org/codehaus/mojo/buildhelper/OsgiArtifactVersion.java --- build-helper-maven-plugin-1.8/src/main/java/org/codehaus/mojo/buildhelper/OsgiArtifactVersion.java 2011-06-21 21:49:10.000000000 +0000 +++ build-helper-maven-plugin-3.0.0/src/main/java/org/codehaus/mojo/buildhelper/OsgiArtifactVersion.java 1970-01-01 00:00:00.000000000 +0000 @@ -1,273 +0,0 @@ -package org.codehaus.mojo.buildhelper; - -/* - * The MIT License - * - * Copyright (c) 2004, The Codehaus - * - * 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. - */ - -import java.util.StringTokenizer; - -import org.apache.maven.artifact.versioning.ArtifactVersion; - -/** - * Default implementation of artifact versioning. - * - * @author Robert Scholte - * @version $Id: OsgiArtifactVersion.java 14209 2011-06-21 21:49:10Z rfscholte $ - */ -public class OsgiArtifactVersion - implements ArtifactVersion -{ - private Integer majorVersion; - - private Integer minorVersion; - - private Integer incrementalVersion; - - private Integer buildNumber; - - private String qualifier; - - /** - *

      Constructor for OsgiArtifactVersion.

      - * - * @param version a {@link java.lang.String} object. - */ - public OsgiArtifactVersion( String version ) - { - parseVersion( version ); - } - - /** {@inheritDoc} */ - public int compareTo( Object o ) - { - OsgiArtifactVersion otherVersion = (OsgiArtifactVersion) o; - - int result = compareIntegers( majorVersion, otherVersion.majorVersion ); - if ( result == 0 ) - { - result = compareIntegers( minorVersion, otherVersion.minorVersion ); - } - if ( result == 0 ) - { - result = compareIntegers( incrementalVersion, otherVersion.incrementalVersion ); - } - if ( result == 0 ) - { - if ( buildNumber != null || otherVersion.buildNumber != null ) - { - result = compareIntegers( buildNumber, otherVersion.buildNumber ); - } - else if ( qualifier != null ) - { - if ( otherVersion.qualifier != null ) - { - if ( qualifier.length() > otherVersion.qualifier.length() - && qualifier.startsWith( otherVersion.qualifier ) ) - { - // here, the longer one that otherwise match is considered older - result = -1; - } - else if ( qualifier.length() < otherVersion.qualifier.length() - && otherVersion.qualifier.startsWith( qualifier ) ) - { - // here, the longer one that otherwise match is considered older - result = 1; - } - else - { - result = qualifier.compareTo( otherVersion.qualifier ); - } - } - else - { - // otherVersion has no qualifier but we do - that's newer - result = -1; - } - } - else if ( otherVersion.qualifier != null ) - { - // otherVersion has a qualifier but we don't, we're newer - result = 1; - } - } - return result; - } - - private int compareIntegers( Integer i1, Integer i2 ) - { - if ( i1 == null ? i2 == null : i1.equals( i2 ) ) - { - return 0; - } - else if ( i1 == null ) - { - return -1; - } - else if ( i2 == null ) - { - return 1; - } - else - { - return i1.intValue() - i2.intValue(); - } - } - - /** - *

      Getter for the field majorVersion.

      - * - * @return a int. - */ - public int getMajorVersion() - { - return majorVersion != null ? majorVersion.intValue() : 0; - } - - /** - *

      Getter for the field minorVersion.

      - * - * @return a int. - */ - public int getMinorVersion() - { - return minorVersion != null ? minorVersion.intValue() : 0; - } - - /** - *

      Getter for the field incrementalVersion.

      - * - * @return a int. - */ - public int getIncrementalVersion() - { - return incrementalVersion != null ? incrementalVersion.intValue() : 0; - } - - /** - *

      Getter for the field buildNumber.

      - * - * @return a int. - */ - public int getBuildNumber() - { - return buildNumber != null ? buildNumber.intValue() : 0; - } - - /** - *

      Getter for the field qualifier.

      - * - * @return a {@link java.lang.String} object. - */ - public String getQualifier() - { - return qualifier; - } - - /** {@inheritDoc} */ - public void parseVersion( String version ) - { - boolean fallback = false; - - if ( version.indexOf( '.' ) == -1 ) - { - fallback = true; - } - else - { - - StringTokenizer tok = new StringTokenizer( version, "." ); - try - { - majorVersion = getNextIntegerToken( tok ); - if ( tok.hasMoreTokens() ) - { - minorVersion = getNextIntegerToken( tok ); - } - if ( tok.hasMoreTokens() ) - { - incrementalVersion = getNextIntegerToken( tok ); - } - if ( tok.hasMoreTokens() ) - { - qualifier = tok.nextToken(); - } - } - catch ( NumberFormatException e ) - { - fallback = true; - } - } - if ( fallback ) - { - // qualifier is the whole version - qualifier = version; - majorVersion = null; - minorVersion = null; - incrementalVersion = null; - } - - } - - private static Integer getNextIntegerToken( StringTokenizer tok ) - { - String s = tok.nextToken(); - if ( s.length() > 1 && s.startsWith( "0" ) ) - { - throw new NumberFormatException( "Number part has a leading 0: '" + s + "'" ); - } - return Integer.valueOf( s ); - } - - /** - *

      toString

      - * - * @return a {@link java.lang.String} object. - */ - public String toString() - { - StringBuffer buf = new StringBuffer(); - if ( majorVersion != null ) - { - buf.append( majorVersion ); - } - if ( minorVersion != null ) - { - buf.append( "." ); - buf.append( minorVersion ); - } - if ( incrementalVersion != null ) - { - buf.append( "." ); - buf.append( incrementalVersion ); - } - if ( qualifier != null ) - { - if ( buf.length() > 0 ) - { - buf.append( "." ); - } - buf.append( qualifier ); - } - return buf.toString(); - } -} diff -Nru build-helper-maven-plugin-1.8/src/main/java/org/codehaus/mojo/buildhelper/ParseVersionMojo.java build-helper-maven-plugin-3.0.0/src/main/java/org/codehaus/mojo/buildhelper/ParseVersionMojo.java --- build-helper-maven-plugin-1.8/src/main/java/org/codehaus/mojo/buildhelper/ParseVersionMojo.java 2012-09-23 10:08:45.000000000 +0000 +++ build-helper-maven-plugin-3.0.0/src/main/java/org/codehaus/mojo/buildhelper/ParseVersionMojo.java 2017-01-29 19:58:46.000000000 +0000 @@ -1,39 +1,13 @@ package org.codehaus.mojo.buildhelper; -/* - * The MIT License - * - * Copyright (c) 2004, The Codehaus - * - * 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. - */ - -import org.apache.maven.artifact.versioning.ArtifactVersion; -import org.apache.maven.artifact.versioning.DefaultArtifactVersion; -import org.apache.maven.plugin.MojoExecutionException; import org.apache.maven.plugins.annotations.LifecyclePhase; import org.apache.maven.plugins.annotations.Mojo; import org.apache.maven.plugins.annotations.Parameter; +import org.codehaus.mojo.buildhelper.versioning.DefaultVersioning; /** - * Parse a version string and set properties containing the component parts of the version. This mojo sets the - * following properties: + * Parse a version string and set properties containing the component parts of the version. This mojo sets the following + * properties: * *
        *   [propertyPrefix].majorVersion
      @@ -42,18 +16,69 @@
        *   [propertyPrefix].qualifier
        *   [propertyPrefix].buildNumber
        * 
      - * Where the propertyPrefix is the string set in the mojo parameter. Note that the behaviour of the - * parsing is determined by org.apache.maven.artifact.versioning.DefaultArtifactVersion - * - * An osgi compatible version will also be created and made available through the property: + * + * Where the propertyPrefix is the string set in the mojo parameter. The parsing of the above is based on the following + * format of the version: + * + *
      + *  <majorversion [> . <minorversion [> . <incrementalversion ] ] [> - <buildnumber | qualifier ]>
      + * 
      + * + * It will be tried to parse the version as an OSGi version. It this is successful the following property will be set + * accordingly. If this is not possible a warning will be emitted. + * *
        *   [propertyPrefix].osgiVersion
        * 
      - * This version is simply the original version string with the first instance of '-' replaced by '.' - * For example, 1.0.2-beta-1 will be converted to 1.0.2.beta-1 + * + * This goal also sets the following properties: + * + *
      + *   [propertyPrefix].nextMajorVersion
      + *   [propertyPrefix].nextMinorVersion
      + *   [propertyPrefix].nextIncrementalVersion
      + *   [propertyPrefix].nextBuildNumber
      + * 
      + * + * This goal also sets the following properties: + * + *
      + *   [formattedPropertyPrefix].majorVersion
      + *   [formattedPropertyPrefix].minorVersion
      + *   [formattedPropertyPrefix].incrementalVersion
      + *   [formattedPropertyPrefix].buildNumber
      + * 
      + * + * This goal also sets the following properties: + * + *
      + *   [formattedPropertyPrefix].nextMajorVersion
      + *   [formattedPropertyPrefix].nextMinorVersion
      + *   [formattedPropertyPrefix].nextIncrementalVersion
      + *   [formattedPropertyPrefix].nextBuildNumber
      + * 
      + * + * The above properties contain simply incremented versions of the parsed version informations. Those can now be used to + * update the version of your project via the following to the next Major version: + * + *
      + *   mvn build-helper:parse-version versions:set \
      + *      -DnewVersion=\${parsedVersion.nextMajorVersion}.0.0 \
      + *      versions:commit
      + * 
      * + * It can of course being used to increment the minor version: + * + *
      + *   mvn build-helper:parse-version versions:set \
      + *      -DnewVersion=\${parsedVersion.majorVersion}.\${parsedVersion.nextMinorVersion}.0 \
      + *      versions:commit
      + * 
      + * + * This can make an upgrade of the versions of your project very convenient. + * * @author pgier - * @version $Id: ParseVersionMojo.java 17589 2012-09-23 10:08:45Z hboutemy $ + * @version $Id$ * @since 1.3 */ @Mojo( name = "parse-version", defaultPhase = LifecyclePhase.VALIDATE, threadSafe = true ) @@ -74,9 +99,44 @@ private String propertyPrefix; /** + * Prefix string to use for the set of formatted version properties. + * @since 3.0.0 + */ + @Parameter( defaultValue = "formattedVersion" ) + private String formattedPropertyPrefix; + + /** + * This can be used to make a particular format of the major number possible like padding it with zeros etc. + * + * @since 3.0.0 + * @see https://docs.oracle.com/javase/7/docs/api/java/util/Formatter.html#syntax + */ + @Parameter( defaultValue = "%02d" ) + private String formatMajor; + + /** + * @since 3.0.0 + * @see https://docs.oracle.com/javase/7/docs/api/java/util/Formatter.html#syntax + */ + @Parameter( defaultValue = "%02d" ) + private String formatMinor; + + /** + * @since 3.0.0 + * @see https://docs.oracle.com/javase/7/docs/api/java/util/Formatter.html#syntax + */ + @Parameter( defaultValue = "%02d" ) + private String formatIncremental; + + /** + * @since 3.0.0 + * @see https://docs.oracle.com/javase/7/docs/api/java/util/Formatter.html#syntax + */ + @Parameter( defaultValue = "%02d" ) + private String formatBuildNumber; + + /** * Execute the mojo. This sets the version properties on the project. - * - * @throws MojoExecutionException if the plugin execution fails. */ public void execute() { @@ -88,6 +148,11 @@ defineProperty( propertyPrefix + '.' + name, value ); } + private void defineFormattedVersionProperty( String name, String value ) + { + defineProperty( formattedPropertyPrefix + '.' + name, value ); + } + private void defineVersionProperty( String name, int value ) { defineVersionProperty( name, Integer.toString( value ) ); @@ -100,72 +165,96 @@ */ public void parseVersion( String version ) { - ArtifactVersion artifactVersion = new DefaultArtifactVersion( version ); + DefaultVersioning artifactVersion = new DefaultVersioning( version ); - if ( version.equals( artifactVersion.getQualifier() ) ) - { - // This means the version parsing failed, so try osgi format. - getLog().debug( "The version is not in the regular format, will try OSGi format instead" ); - artifactVersion = new OsgiArtifactVersion( version ); - } + getLog().debug( "Parsed Version" ); + getLog().debug( " major: " + artifactVersion.getMajor() ); + getLog().debug( " minor: " + artifactVersion.getMinor() ); + getLog().debug( " incremental: " + artifactVersion.getPatch() ); + getLog().debug( " buildnumber: " + artifactVersion.getBuildNumber() ); + getLog().debug( " qualifier: " + artifactVersion.getQualifier() ); + + defineVersionProperty( "majorVersion", artifactVersion.getMajor() ); + defineVersionProperty( "minorVersion", artifactVersion.getMinor() ); + defineVersionProperty( "incrementalVersion", artifactVersion.getPatch() ); + defineVersionProperty( "buildNumber", artifactVersion.getBuildNumber() ); - defineVersionProperty( "majorVersion", artifactVersion.getMajorVersion() ); - defineVersionProperty( "minorVersion", artifactVersion.getMinorVersion() ); - defineVersionProperty( "incrementalVersion", artifactVersion.getIncrementalVersion() ); - defineVersionProperty( "nextMajorVersion", artifactVersion.getMajorVersion() + 1 ); - defineVersionProperty( "nextMinorVersion", artifactVersion.getMinorVersion() + 1 ); - defineVersionProperty( "nextIncrementalVersion", artifactVersion.getIncrementalVersion() + 1 ); + defineVersionProperty( "nextMajorVersion", artifactVersion.getMajor() + 1 ); + defineVersionProperty( "nextMinorVersion", artifactVersion.getMinor() + 1 ); + defineVersionProperty( "nextIncrementalVersion", artifactVersion.getPatch() + 1 ); + defineVersionProperty( "nextBuildNumber", artifactVersion.getBuildNumber() + 1 ); + + defineFormattedVersionProperty( "majorVersion", String.format( formatMajor, artifactVersion.getMajor() ) ); + defineFormattedVersionProperty( "minorVersion", String.format( formatMinor, artifactVersion.getMinor() ) ); + defineFormattedVersionProperty( "incrementalVersion", String.format( formatIncremental, artifactVersion.getPatch() ) ); + defineFormattedVersionProperty( "buildNumber", String.format( formatBuildNumber, artifactVersion.getBuildNumber() )); + + defineFormattedVersionProperty( "nextMajorVersion", String.format( formatMajor, artifactVersion.getMajor() + 1 )); + defineFormattedVersionProperty( "nextMinorVersion", String.format( formatMinor, artifactVersion.getMinor() + 1 )); + defineFormattedVersionProperty( "nextIncrementalVersion", String.format( formatIncremental, artifactVersion.getPatch() + 1 )); + defineFormattedVersionProperty( "nextBuildNumber", String.format( formatBuildNumber, artifactVersion.getBuildNumber() + 1 )); + + String osgi = artifactVersion.getAsOSGiVersion(); String qualifier = artifactVersion.getQualifier(); if ( qualifier == null ) { qualifier = ""; } - defineVersionProperty( "qualifier", qualifier ); - defineVersionProperty( "buildNumber", artifactVersion.getBuildNumber() ); + defineVersionProperty( "qualifier", qualifier ); - // Replace the first instance of "-" to create an osgi compatible version string. - String osgiVersion = getOsgiVersion( artifactVersion ); - defineVersionProperty( "osgiVersion", osgiVersion ); + defineVersionProperty( "osgiVersion", osgi ); } + /** + * Set property name prefix. + * + * @param prefix The prefix to be used. + */ public void setPropertyPrefix( String prefix ) { this.propertyPrefix = prefix; } /** - * Make an osgi compatible version String from an ArtifactVersion - * @param version - * @return + * @param formattedPropertyPrefix The prefix used for formatted properties. */ - public String getOsgiVersion( ArtifactVersion version ) + public void setFormattedPropertyPrefix( String formattedPropertyPrefix ) { - if ( version.toString().equals( version.getQualifier() ) ) - { - return version.toString(); - } + this.formattedPropertyPrefix = formattedPropertyPrefix; + } - StringBuffer osgiVersion = new StringBuffer(); - osgiVersion.append( version.getMajorVersion() ); - osgiVersion.append( "." + version.getMinorVersion() ); - osgiVersion.append( "." + version.getIncrementalVersion() ); + /** + * @param formatMajor Set the format for major part. + */ + public void setFormatMajor( String formatMajor ) + { + this.formatMajor = formatMajor; + } - if ( version.getQualifier() != null || version.getBuildNumber() != 0 ) - { - osgiVersion.append( "." ); + /** + * @param formatMinor Set the format for minor part. + */ + public void setFormatMinor( String formatMinor ) + { + this.formatMinor = formatMinor; + } - if ( version.getQualifier() != null ) - { - osgiVersion.append( version.getQualifier() ); - } - if ( version.getBuildNumber() != 0 ) - { - osgiVersion.append( version.getBuildNumber() ); - } - } + /** + * @param formatIncremental Set format for incremental part. + */ + public void setFormatIncremental( String formatIncremental ) + { + this.formatIncremental = formatIncremental; + } - return osgiVersion.toString(); + /** + * @param formatBuildNumber Set the format for the buildNumber part. + */ + public void setFormatBuildNumber( String formatBuildNumber ) + { + this.formatBuildNumber = formatBuildNumber; } + } diff -Nru build-helper-maven-plugin-1.8/src/main/java/org/codehaus/mojo/buildhelper/RegexPropertiesMojo.java build-helper-maven-plugin-3.0.0/src/main/java/org/codehaus/mojo/buildhelper/RegexPropertiesMojo.java --- build-helper-maven-plugin-1.8/src/main/java/org/codehaus/mojo/buildhelper/RegexPropertiesMojo.java 1970-01-01 00:00:00.000000000 +0000 +++ build-helper-maven-plugin-3.0.0/src/main/java/org/codehaus/mojo/buildhelper/RegexPropertiesMojo.java 2017-01-29 19:58:46.000000000 +0000 @@ -0,0 +1,62 @@ +package org.codehaus.mojo.buildhelper; + +/* + * The MIT License + * + * Copyright (c) 2004, The Codehaus + * + * 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. + */ + +import java.util.ArrayList; +import java.util.List; + +import org.apache.maven.plugin.MojoExecutionException; +import org.apache.maven.plugin.MojoFailureException; +import org.apache.maven.plugins.annotations.LifecyclePhase; +import org.apache.maven.plugins.annotations.Mojo; +import org.apache.maven.plugins.annotations.Parameter; + +/** + * Sets a property by applying a regex replacement rule to a supplied value. This is similar to regex-property goal with + * support for multiple regex settings using RegexPropertyConfig + * + * @since 1.9 + */ +@Mojo( name = "regex-properties", defaultPhase = LifecyclePhase.VALIDATE, threadSafe = true ) +public class RegexPropertiesMojo + extends AbstractRegexPropertyMojo +{ + /** + * List of RegexPropertyConfig to apply the regex + */ + @Parameter( required = false ) + private List regexPropertySettings = new ArrayList(); + + public void execute() + throws MojoExecutionException, MojoFailureException + { + + for ( RegexPropertySetting setting : regexPropertySettings ) + { + this.execute( setting ); + } + } + +} diff -Nru build-helper-maven-plugin-1.8/src/main/java/org/codehaus/mojo/buildhelper/RegexPropertyMojo.java build-helper-maven-plugin-3.0.0/src/main/java/org/codehaus/mojo/buildhelper/RegexPropertyMojo.java --- build-helper-maven-plugin-1.8/src/main/java/org/codehaus/mojo/buildhelper/RegexPropertyMojo.java 2013-03-27 14:19:59.000000000 +0000 +++ build-helper-maven-plugin-3.0.0/src/main/java/org/codehaus/mojo/buildhelper/RegexPropertyMojo.java 2017-01-29 19:58:46.000000000 +0000 @@ -29,21 +29,16 @@ import org.apache.maven.plugins.annotations.LifecyclePhase; import org.apache.maven.plugins.annotations.Mojo; import org.apache.maven.plugins.annotations.Parameter; -import org.codehaus.plexus.util.StringUtils; - -import java.util.regex.Matcher; -import java.util.regex.Pattern; -import java.util.regex.PatternSyntaxException; /** * Sets a property by applying a regex replacement rule to a supplied value. - * + * * @author Stephen Connolly * @since 1.7 */ @Mojo( name = "regex-property", defaultPhase = LifecyclePhase.VALIDATE, threadSafe = true ) public class RegexPropertyMojo - extends AbstractDefinePropertyMojo + extends AbstractRegexPropertyMojo { /** * The property to set. @@ -76,41 +71,38 @@ private boolean failIfNoMatch; /** + * Make the value of the resulting property upper case. + * + * @since 1.11 + */ + @Parameter( defaultValue = "false" ) + private boolean toUpperCase; + + /** + * Make the value of the resulting property lower case. + * + * @since 1.11 + */ + @Parameter( defaultValue = "false" ) + private boolean toLowerCase; + + /** * {@inheritDoc} */ public void execute() throws MojoExecutionException, MojoFailureException { - Pattern pattern; - try - { - pattern = Pattern.compile( regex ); - } - catch ( PatternSyntaxException e ) - { - throw new MojoExecutionException( e.getMessage(), e ); - } - Matcher matcher = pattern.matcher( value ); - - if ( matcher.find() ) - { - // if the string replacement is empty, we define the value replacement to empty. - value = - ( StringUtils.isNotEmpty( replacement ) ) ? matcher.replaceAll( replacement ) : matcher.replaceAll( "" ); - } - else - { - if ( failIfNoMatch ) - { - throw new MojoFailureException( "No match to regex '" + regex + "' found in '" + value + "'." ); - } - else - { - getLog().info( "No match to regex '" + regex + "' found in '" + value + "'. " + "The initial value '" - + value + "' is left as-is..." ); - } - } + RegexPropertySetting config = new RegexPropertySetting(); + config.setName( name ); + config.setValue( value ); + config.setRegex( regex ); + config.setReplacement( replacement ); + config.setFailIfNoMatch( failIfNoMatch ); + config.setToLowerCase( toLowerCase ); + config.setToUpperCase( toUpperCase ); + + this.execute( config ); - defineProperty( name, value ); } + } diff -Nru build-helper-maven-plugin-1.8/src/main/java/org/codehaus/mojo/buildhelper/RegexPropertySetting.java build-helper-maven-plugin-3.0.0/src/main/java/org/codehaus/mojo/buildhelper/RegexPropertySetting.java --- build-helper-maven-plugin-1.8/src/main/java/org/codehaus/mojo/buildhelper/RegexPropertySetting.java 1970-01-01 00:00:00.000000000 +0000 +++ build-helper-maven-plugin-3.0.0/src/main/java/org/codehaus/mojo/buildhelper/RegexPropertySetting.java 2017-01-29 19:58:46.000000000 +0000 @@ -0,0 +1,167 @@ +package org.codehaus.mojo.buildhelper; + +/* + * The MIT License + * + * Copyright (c) 2004, The Codehaus + * + * 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. + */ + +import org.apache.maven.plugins.annotations.Parameter; +import org.codehaus.plexus.util.StringUtils; + +public class RegexPropertySetting +{ + /** + * The property to set. + */ + @Parameter( required = true ) + private String name; + + /** + * The pre-transformation value. + */ + @Parameter( required = true ) + private String value; + + /** + * The regex to replace. + */ + @Parameter( required = true ) + private String regex; + + /** + * The replacement. + */ + @Parameter( defaultValue = "" ) + private String replacement = ""; + + /** + * Whether to fail if no match is found. + */ + @Parameter( defaultValue = "true" ) + private boolean failIfNoMatch = true; + + /** + * Change the case of the value to upper case if set to true. + */ + @Parameter( defaultValue = "false" ) + private boolean toUpperCase = false; + + /** + * Change the case of the value to lower case if set to true. + */ + @Parameter( defaultValue = "false" ) + private boolean toLowerCase = false; + + public String getName() + { + return name; + } + + public void setName( String name ) + { + this.name = name; + } + + public String getValue() + { + return value; + } + + public void setValue( String value ) + { + this.value = value; + } + + public String getRegex() + { + return regex; + } + + public void setRegex( String regex ) + { + this.regex = regex; + } + + public String getReplacement() + { + return replacement; + } + + public void setReplacement( String replacement ) + { + this.replacement = replacement; + } + + public boolean isFailIfNoMatch() + { + return failIfNoMatch; + } + + public void setFailIfNoMatch( boolean failIfNoMatch ) + { + this.failIfNoMatch = failIfNoMatch; + } + + public boolean isToUpperCase() + { + return toUpperCase; + } + + public void setToUpperCase( boolean toUpperCase ) + { + this.toUpperCase = toUpperCase; + } + + public boolean isToLowerCase() + { + return toLowerCase; + } + + public void setToLowerCase( boolean toLowerCase ) + { + this.toLowerCase = toLowerCase; + } + + public void validate() + { + if ( StringUtils.isBlank( name ) ) + { + throw new IllegalArgumentException( "name required" ); + } + + if ( StringUtils.isBlank( value ) ) + { + throw new IllegalArgumentException( "value required" ); + } + + if ( StringUtils.isBlank( regex ) ) + { + throw new IllegalArgumentException( "regex required" ); + } + + if ( toLowerCase && toUpperCase ) + { + throw new IllegalArgumentException( "either toUpperCase or toLowerCase can be set, but not both." ); + } + } + +} diff -Nru build-helper-maven-plugin-1.8/src/main/java/org/codehaus/mojo/buildhelper/ReleasedVersionMojo.java build-helper-maven-plugin-3.0.0/src/main/java/org/codehaus/mojo/buildhelper/ReleasedVersionMojo.java --- build-helper-maven-plugin-1.8/src/main/java/org/codehaus/mojo/buildhelper/ReleasedVersionMojo.java 2012-09-23 10:08:45.000000000 +0000 +++ build-helper-maven-plugin-3.0.0/src/main/java/org/codehaus/mojo/buildhelper/ReleasedVersionMojo.java 2017-01-29 19:58:46.000000000 +0000 @@ -38,18 +38,17 @@ import org.apache.maven.plugins.annotations.Parameter; /** - * Resolve the latest released version of this project. - * This mojo sets the following properties: - * + * Resolve the latest released version of this project. This mojo sets the following properties: + * *
        *   [propertyPrefix].version
        *   [propertyPrefix].majorVersion
        *   [propertyPrefix].minorVersion
      - *   [propertyPrefix].incrementalVersion   
      + *   [propertyPrefix].incrementalVersion
        * 
      - * + * * Where the propertyPrefix is the string set in the mojo parameter. - * + * * @author Robert Scholte * @since 1.6 */ @@ -98,11 +97,12 @@ { ArtifactVersion releasedVersion = null; List versions = - artifactMetadataSource.retrieveAvailableVersions( artifact, localRepository, remoteArtifactRepositories ); + artifactMetadataSource.retrieveAvailableVersions( artifact, localRepository, + remoteArtifactRepositories ); for ( ArtifactVersion version : versions ) { if ( !ArtifactUtils.isSnapshot( version.toString() ) - && ( releasedVersion == null || version.compareTo( releasedVersion ) == 1 ) ) + && ( releasedVersion == null || version.compareTo( releasedVersion ) > 0 ) ) { releasedVersion = version; } diff -Nru build-helper-maven-plugin-1.8/src/main/java/org/codehaus/mojo/buildhelper/RemoveLocalArtifactMojo.java build-helper-maven-plugin-3.0.0/src/main/java/org/codehaus/mojo/buildhelper/RemoveLocalArtifactMojo.java --- build-helper-maven-plugin-1.8/src/main/java/org/codehaus/mojo/buildhelper/RemoveLocalArtifactMojo.java 2012-09-22 20:42:37.000000000 +0000 +++ build-helper-maven-plugin-3.0.0/src/main/java/org/codehaus/mojo/buildhelper/RemoveLocalArtifactMojo.java 2017-01-29 19:58:46.000000000 +0000 @@ -24,14 +24,12 @@ * SOFTWARE. */ - import java.io.File; import java.io.IOException; import org.apache.maven.artifact.repository.ArtifactRepository; import org.apache.maven.plugin.AbstractMojo; import org.apache.maven.plugin.MojoFailureException; -import org.apache.maven.plugins.annotations.Component; import org.apache.maven.plugins.annotations.LifecyclePhase; import org.apache.maven.plugins.annotations.Mojo; import org.apache.maven.plugins.annotations.Parameter; @@ -39,11 +37,11 @@ import org.codehaus.plexus.util.FileUtils; /** - * Remove project's artifacts from local repository. Useful to keep only one copy of large local snapshot, - * for example: installer, for disk space optimization purpose. + * Remove project's artifacts from local repository. Useful to keep only one copy of large local snapshot, for example: + * installer, for disk space optimization purpose. * * @author Dan T. Tran - * @version $Id: RemoveLocalArtifactMojo.java 17587 2012-09-22 20:42:37Z hboutemy $ + * @version $Id$ * @since 1.1 */ @Mojo( name = "remove-project-artifact", defaultPhase = LifecyclePhase.PACKAGE, threadSafe = true ) @@ -52,8 +50,8 @@ { /** - * When true, remove all built artifacts including all versions. - * When false, remove all built artifacts of this project version. + * When true, remove all built artifacts including all versions. When false, remove all built artifacts of this + * project version. * * @since 1.1 */ @@ -71,7 +69,7 @@ /** * @since 1.1 */ - @Component + @Parameter( readonly = true, defaultValue = "${project}" ) private MavenProject project; /** diff -Nru build-helper-maven-plugin-1.8/src/main/java/org/codehaus/mojo/buildhelper/ReserveListenerPortMojo.java build-helper-maven-plugin-3.0.0/src/main/java/org/codehaus/mojo/buildhelper/ReserveListenerPortMojo.java --- build-helper-maven-plugin-1.8/src/main/java/org/codehaus/mojo/buildhelper/ReserveListenerPortMojo.java 2013-03-27 14:51:22.000000000 +0000 +++ build-helper-maven-plugin-3.0.0/src/main/java/org/codehaus/mojo/buildhelper/ReserveListenerPortMojo.java 2017-01-29 19:58:46.000000000 +0000 @@ -24,18 +24,25 @@ * SOFTWARE. */ +import java.io.BufferedInputStream; +import java.io.BufferedReader; import java.io.File; import java.io.FileOutputStream; import java.io.IOException; +import java.io.InputStream; +import java.io.InputStreamReader; import java.io.OutputStream; +import java.net.MalformedURLException; import java.net.ServerSocket; +import java.net.URL; import java.util.ArrayList; +import java.util.Collections; +import java.util.Iterator; import java.util.List; import java.util.Properties; 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.LifecyclePhase; import org.apache.maven.plugins.annotations.Mojo; import org.apache.maven.plugins.annotations.Parameter; @@ -44,7 +51,7 @@ /** * Reserve a list of random and not in use network ports and place them in a configurable project properties. - * + * * @author Dan T. Tran * @version $Id: ReserveListnerPortMojo.java 6754 2008-04-13 15:14:04Z dantran $ * @since 1.2 @@ -57,19 +64,31 @@ private static final Integer FIRST_NON_ROOT_PORT_NUMBER = 1024; - private static final Integer MAX_PORT_NUMBER = 65536; + private static final Integer MAX_PORT_NUMBER = 65535; + + private static final Object lock = new Object(); /** - * A List to property names to be placed in Maven project - * + * A List to property names to be placed in Maven project. At least one of {@code #urls} or {@code #portNames} has + * to be specified. + * * @since 1.2 */ - @Parameter( required = true ) + @Parameter private String[] portNames = new String[0]; /** - * Output file to write the generated properties to. if not given, they are written to Maven project + * A List of urls to resource where list of name could be found. Can be in form of classpath:com/myproject/names.txt + * . At least one of {@code #urls} or {@code #portNames} has to be specified. * + * @since 1.11 + */ + @Parameter + private String[] urls = new String[0]; + + /** + * Output file to write the generated properties to. if not given, they are written to Maven project + * * @since 1.2 */ @Parameter @@ -80,7 +99,7 @@ *

      * If {@link #maxPortNumber} is specified, defaults to {@value #FIRST_NON_ROOT_PORT_NUMBER}. *

      - * + * * @since 1.8 */ @Parameter @@ -88,18 +107,29 @@ /** * Specify this if you want the port be chosen with a number lower than that one. - * + * * @since 1.8 */ @Parameter private Integer maxPortNumber; /** + * Specify true or false if you want the port selection randomized. + *

      + *

      + * + * @since 1.10 + */ + @Parameter + private boolean randomPort; + + /** * @since 1.2 */ - @Component + @Parameter( readonly = true, defaultValue = "${project}" ) private MavenProject project; + @Override public void execute() throws MojoExecutionException { @@ -110,6 +140,8 @@ properties = new Properties(); } + loadUrls(); + // Reserve the entire block of ports to guarantee we don't get the same port twice final List sockets = new ArrayList(); try @@ -174,7 +206,7 @@ { if ( minPortNumber == null && maxPortNumber != null ) { - getLog().debug( "minPortNumber unspecified: using default value " + FIRST_NON_ROOT_PORT_NUMBER ); + getLog().debug( "minPortNumber unspecified: using default value " + FIRST_NON_ROOT_PORT_NUMBER ); minPortNumber = FIRST_NON_ROOT_PORT_NUMBER; } if ( minPortNumber != null && maxPortNumber == null ) @@ -186,32 +218,90 @@ { return new ServerSocket( 0 ); } - else + if ( randomPort ) { - int min = getNextPortNumber(); - for ( int port = min;; ++port ) + synchronized ( lock ) { - if ( port > maxPortNumber ) - { - throw new MojoExecutionException( "Unable to find an available port between " + minPortNumber - + " and " + maxPortNumber ); - } - try + List availablePorts = randomPortList(); + for ( Iterator iterator = availablePorts.iterator(); iterator.hasNext(); ) { - ServerSocket serverSocket = new ServerSocket( port ); - return serverSocket; + int port = iterator.next(); + ServerSocket serverSocket = reservePort( port ); + iterator.remove(); + if ( serverSocket != null ) + { + return serverSocket; + } } - catch ( IOException ioe ) + throw new MojoExecutionException( "Unable to find an available port between " + minPortNumber + " and " + + maxPortNumber ); + } + } + else + { + // Might be synchronizing a bit too largely, but at least that defensive approach should prevent + // threading issues (essentially possible while put/getting the plugin ctx to get the reserved ports). + synchronized ( lock ) + { + int min = getNextPortNumber(); + + for ( int port = min;; ++port ) { - getLog().debug( "Tried binding to port " + port + " without success. Trying next port.", ioe ); + + ServerSocket serverSocket = reservePort( port ); + if ( serverSocket != null ) + { + return serverSocket; + } } } } } + private List randomPortList() + { + + int difference = maxPortNumber - minPortNumber + 1; + List portList = new ArrayList( difference ); + List reservedPorts = getReservedPorts(); + for ( int i = 0; i < difference; i++ ) + { + int port = minPortNumber + i; + if ( !reservedPorts.contains( port ) ) + { + portList.add( minPortNumber + i ); + } + } + Collections.shuffle( portList ); + return portList; + } + + public ServerSocket reservePort( int port ) + throws MojoExecutionException + { + + if ( port > maxPortNumber ) + { + throw new MojoExecutionException( "Unable to find an available port between " + minPortNumber + " and " + + maxPortNumber ); + } + try + { + ServerSocket serverSocket = new ServerSocket( port ); + getLog().info( "Port assigned" + port ); + return serverSocket; + } + catch ( IOException ioe ) + { + getLog().info( "Tried binding to port " + port + " without success. Trying next port.", ioe ); + } + return null; + } + private int getNextPortNumber() { assert minPortNumber != null; + List reservedPorts = getReservedPorts(); int nextPort = -1; if ( reservedPorts.isEmpty() ) @@ -227,8 +317,10 @@ return nextPort; } + @SuppressWarnings( "unchecked" ) private List getReservedPorts() { + List reservedPorts = (List) getPluginContext().get( BUILD_HELPER_RESERVED_PORTS ); if ( reservedPorts == null ) { @@ -241,7 +333,7 @@ /** * Returns the first number available, starting at portNumberStartingPoint that's not already in the reservedPorts * list. - * + * * @param portNumberStartingPoint first port number to start from. * @param reservedPorts the ports already reserved. * @return first number available not in the given list, starting at the given parameter. @@ -256,4 +348,164 @@ } return candidate; } + + private void loadUrls() + throws MojoExecutionException + { + for ( String url : urls ) + { + load( new UrlResource( url ) ); + } + } + + private void load( UrlResource resource ) + throws MojoExecutionException + { + if ( resource.canBeOpened() ) + { + loadPortNamesFromResource( resource ); + } + else + { + throw new MojoExecutionException( "Port names could not be loaded from \"" + resource + "\"" ); + } + } + + private void loadPortNamesFromResource( UrlResource resource ) + throws MojoExecutionException + { + try + { + if ( getLog().isDebugEnabled() ) + { + getLog().debug( "Loading port names from " + resource ); + } + final InputStream stream = resource.getInputStream(); + + try + { + BufferedReader reader = new BufferedReader( new InputStreamReader( stream ) ); + List names = new ArrayList(); + String line; + while ( ( line = reader.readLine() ) != null ) + { + line = line.trim(); + if ( !line.isEmpty() && !line.replace( " ", "" ).startsWith( "#" ) ) + { + names.add( line ); + } + } + if ( getLog().isDebugEnabled() ) + { + getLog().debug( "Loaded port names " + names ); + } + String[] tPortNames = names.toArray( new String[portNames.length + names.size()] ); + if ( portNames.length > 0 ) + { + System.arraycopy( portNames, 0, tPortNames, names.size(), portNames.length ); + } + portNames = tPortNames; + } + finally + { + stream.close(); + } + } + catch ( IOException e ) + { + throw new MojoExecutionException( "Error reading port names from \"" + resource + "\"", e ); + } + } + + private class UrlResource + { + private static final String CLASSPATH_PREFIX = "classpath:"; + + private static final String SLASH_PREFIX = "/"; + + private final URL url; + + private boolean isMissingClasspathResouce = false; + + private String classpathUrl; + + private InputStream stream; + + public UrlResource( String url ) + throws MojoExecutionException + { + if ( url.startsWith( CLASSPATH_PREFIX ) ) + { + String resource = url.substring( CLASSPATH_PREFIX.length(), url.length() ); + if ( resource.startsWith( SLASH_PREFIX ) ) + { + resource = resource.substring( 1, resource.length() ); + } + this.url = getClass().getClassLoader().getResource( resource ); + if ( this.url == null ) + { + if ( getLog().isDebugEnabled() ) + { + getLog().debug( "Can not load classpath resouce \"" + url + "\"" ); + } + isMissingClasspathResouce = true; + classpathUrl = url; + } + } + else + { + try + { + this.url = new URL( url ); + } + catch ( MalformedURLException e ) + { + throw new MojoExecutionException( "Badly formed URL " + url + " - " + e.getMessage() ); + } + } + } + + public InputStream getInputStream() + throws IOException + { + if ( stream == null ) + { + stream = openStream(); + } + return stream; + } + + public boolean canBeOpened() + { + if ( isMissingClasspathResouce ) + { + return false; + } + try + { + openStream().close(); + } + catch ( IOException e ) + { + return false; + } + return true; + } + + private InputStream openStream() + throws IOException + { + return new BufferedInputStream( url.openStream() ); + } + + @Override + public String toString() + { + if ( !isMissingClasspathResouce ) + { + return "URL " + url.toString(); + } + return classpathUrl; + } + } } diff -Nru build-helper-maven-plugin-1.8/src/main/java/org/codehaus/mojo/buildhelper/RootLocationMojo.java build-helper-maven-plugin-3.0.0/src/main/java/org/codehaus/mojo/buildhelper/RootLocationMojo.java --- build-helper-maven-plugin-1.8/src/main/java/org/codehaus/mojo/buildhelper/RootLocationMojo.java 1970-01-01 00:00:00.000000000 +0000 +++ build-helper-maven-plugin-3.0.0/src/main/java/org/codehaus/mojo/buildhelper/RootLocationMojo.java 2017-01-29 19:58:46.000000000 +0000 @@ -0,0 +1,49 @@ +package org.codehaus.mojo.buildhelper; + +import org.apache.maven.execution.MavenSession; +import org.apache.maven.plugins.annotations.LifecyclePhase; +import org.apache.maven.plugins.annotations.Mojo; +import org.apache.maven.plugins.annotations.Parameter; + +/** + * This goal will get the location of the root folder within a multi module build as a property {@code rootlocation}. + * + * @author Karl Heinz Marbaise + * @since 3.0.0 + */ +@Mojo( name = "rootlocation", defaultPhase = LifecyclePhase.VALIDATE, threadSafe = true ) +public class RootLocationMojo + extends AbstractDefinePropertyMojo +{ + + @Parameter( defaultValue = "${session}", readonly = true, required = true ) + private MavenSession session; + + /** + * This will cause the execution to be run only at the top of a given module tree. + */ + @Parameter( property = "buildhelper.runOnlyAtExecutionRoot", defaultValue = "false" ) + private boolean runOnlyAtExecutionRoot; + + /** + * The name of the property in which to store the root location. + */ + @Parameter( defaultValue = "rootlocation" ) + private String rootLocationProperty; + + /** + * Main plugin execution + */ + public void execute() + { + if ( runOnlyAtExecutionRoot && !getProject().isExecutionRoot() ) + { + getLog().info( "Skip getting the rootlocation in this project because it's not the Execution Root" ); + } + else + { + defineProperty( rootLocationProperty, session.getTopLevelProject().getBasedir().getAbsolutePath() ); + } + } + +} \ No newline at end of file diff -Nru build-helper-maven-plugin-1.8/src/main/java/org/codehaus/mojo/buildhelper/TimestampPropertyMojo.java build-helper-maven-plugin-3.0.0/src/main/java/org/codehaus/mojo/buildhelper/TimestampPropertyMojo.java --- build-helper-maven-plugin-1.8/src/main/java/org/codehaus/mojo/buildhelper/TimestampPropertyMojo.java 2012-09-23 10:08:45.000000000 +0000 +++ build-helper-maven-plugin-3.0.0/src/main/java/org/codehaus/mojo/buildhelper/TimestampPropertyMojo.java 2017-01-29 19:58:46.000000000 +0000 @@ -24,12 +24,6 @@ * SOFTWARE. */ -import org.apache.maven.plugin.MojoExecutionException; -import org.apache.maven.plugin.MojoFailureException; -import org.apache.maven.plugins.annotations.LifecyclePhase; -import org.apache.maven.plugins.annotations.Mojo; -import org.apache.maven.plugins.annotations.Parameter; - import java.text.DateFormat; import java.text.SimpleDateFormat; import java.util.Calendar; @@ -38,11 +32,16 @@ import java.util.Locale; import java.util.TimeZone; +import org.apache.maven.plugin.MojoExecutionException; +import org.apache.maven.plugin.MojoFailureException; +import org.apache.maven.plugins.annotations.LifecyclePhase; +import org.apache.maven.plugins.annotations.Mojo; +import org.apache.maven.plugins.annotations.Parameter; + /** * Sets a property based on the current date and time. * * @author Stephen Connolly - * @description Sets a property to the current time * @since 1.7 */ @Mojo( name = "timestamp-property", defaultPhase = LifecyclePhase.VALIDATE, threadSafe = true ) @@ -127,7 +126,7 @@ { locale = Locale.getDefault(); getLog().warn( "Using platform locale (" + locale.toString() - + " actually) to format date/time, i.e. build is platform dependent!" ); + + " actually) to format date/time, i.e. build is platform dependent!" ); } DateFormat format; diff -Nru build-helper-maven-plugin-1.8/src/main/java/org/codehaus/mojo/buildhelper/UpToDatePropertiesMojo.java build-helper-maven-plugin-3.0.0/src/main/java/org/codehaus/mojo/buildhelper/UpToDatePropertiesMojo.java --- build-helper-maven-plugin-1.8/src/main/java/org/codehaus/mojo/buildhelper/UpToDatePropertiesMojo.java 1970-01-01 00:00:00.000000000 +0000 +++ build-helper-maven-plugin-3.0.0/src/main/java/org/codehaus/mojo/buildhelper/UpToDatePropertiesMojo.java 2017-01-29 19:58:46.000000000 +0000 @@ -0,0 +1,77 @@ +package org.codehaus.mojo.buildhelper; + +/* + * The MIT License + * + * Copyright (c) 2004, The Codehaus + * + * 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. + */ + +import java.util.List; + +import org.apache.maven.plugin.MojoExecutionException; +import org.apache.maven.plugin.MojoFailureException; +import org.apache.maven.plugins.annotations.LifecyclePhase; +import org.apache.maven.plugins.annotations.Mojo; +import org.apache.maven.plugins.annotations.Parameter; + +/** + * Sets multiple properties according to whether multiple sets of source and target resources are respectively up to + * date. + * + * @author Adrian Price demonfiddler@virginmedia.com + * @since 1.12 + */ +@Mojo( name = "uptodate-properties", defaultPhase = LifecyclePhase.VALIDATE, threadSafe = true ) +public class UpToDatePropertiesMojo + extends AbstractUpToDatePropertyMojo +{ + /** + * List of UpToDatePropertySettings to apply. + */ + @Parameter( required = false ) + private List upToDatePropertySettings; + + /** + * Disables the plug-in execution. + */ + @Parameter( property = "buildhelper.uptodateproperties.skip", defaultValue = "false" ) + private boolean skip; + + /** {@inheritDoc} */ + @Override + public void execute() + throws MojoExecutionException, MojoFailureException + { + if ( skip ) + { + getLog().info( "uptodate-properties is skipped." ); + return; + } + + if ( upToDatePropertySettings != null ) + { + for ( UpToDatePropertySetting config : upToDatePropertySettings ) + { + this.execute( config ); + } + } + } +} diff -Nru build-helper-maven-plugin-1.8/src/main/java/org/codehaus/mojo/buildhelper/UpToDatePropertyMojo.java build-helper-maven-plugin-3.0.0/src/main/java/org/codehaus/mojo/buildhelper/UpToDatePropertyMojo.java --- build-helper-maven-plugin-1.8/src/main/java/org/codehaus/mojo/buildhelper/UpToDatePropertyMojo.java 1970-01-01 00:00:00.000000000 +0000 +++ build-helper-maven-plugin-3.0.0/src/main/java/org/codehaus/mojo/buildhelper/UpToDatePropertyMojo.java 2017-01-29 19:58:46.000000000 +0000 @@ -0,0 +1,92 @@ +package org.codehaus.mojo.buildhelper; + +/* + * The MIT License + * + * Copyright (c) 2004, The Codehaus + * + * 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. + */ + +import org.apache.maven.plugin.MojoExecutionException; +import org.apache.maven.plugin.MojoFailureException; +import org.apache.maven.plugins.annotations.LifecyclePhase; +import org.apache.maven.plugins.annotations.Mojo; +import org.apache.maven.plugins.annotations.Parameter; +import org.apache.maven.shared.model.fileset.FileSet; + +/** + * Sets a property according to whether one set of resources is up to date with respect to another. + * + * @author Adrian Price demonfiddler@virginmedia.com + * @since 1.12 + */ +@Mojo( name = "uptodate-property", defaultPhase = LifecyclePhase.VALIDATE, threadSafe = true ) +public class UpToDatePropertyMojo + extends AbstractUpToDatePropertyMojo +{ + /** + * The name of the property to set. + */ + @Parameter( required = true ) + private String name; + + /** + * Disables the plug-in execution. + */ + @Parameter( property = "buildhelper.uptodateproperty.skip", defaultValue = "false" ) + private boolean skip; + + /** + * The file set to check. + */ + @Parameter( required = true ) + private FileSet fileSet; + + /** + * The property value to set if the up-to-date condition is fulfilled. + */ + @Parameter( defaultValue = "true" ) + private String value; + + /** + * The property value to set if the up-to-date condition is not fulfilled. + */ + @Parameter( alias = "else" ) + private String elseValue; + + /** {@inheritDoc} */ + @Override + public void execute() + throws MojoExecutionException, MojoFailureException + { + if ( skip ) + { + getLog().info( "uptodate-property is skipped." ); + return; + } + + UpToDatePropertySetting config = new UpToDatePropertySetting(); + config.setName( name ); + config.setValue( value ); + config.setElse( elseValue ); + config.setFileSet( fileSet ); + execute( config ); + } +} diff -Nru build-helper-maven-plugin-1.8/src/main/java/org/codehaus/mojo/buildhelper/UpToDatePropertySetting.java build-helper-maven-plugin-3.0.0/src/main/java/org/codehaus/mojo/buildhelper/UpToDatePropertySetting.java --- build-helper-maven-plugin-1.8/src/main/java/org/codehaus/mojo/buildhelper/UpToDatePropertySetting.java 1970-01-01 00:00:00.000000000 +0000 +++ build-helper-maven-plugin-3.0.0/src/main/java/org/codehaus/mojo/buildhelper/UpToDatePropertySetting.java 2017-01-29 19:58:46.000000000 +0000 @@ -0,0 +1,139 @@ +package org.codehaus.mojo.buildhelper; + +/* + * The MIT License + * + * Copyright (c) 2004, The Codehaus + * + * 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. + */ + +import org.apache.maven.plugins.annotations.Parameter; +import org.apache.maven.shared.model.fileset.FileSet; +import org.codehaus.plexus.util.StringUtils; + +/** + * Holds settings for AbstractUpToDateProperty subclasses. + * + * @author Adrian Price demonfiddler@virginmedia.com + * @since 1.12 + */ +public final class UpToDatePropertySetting +{ + /** + * A set of source files. + */ + @Parameter + private FileSet fileSet; + + /** + * The name of the property to set. + */ + @Parameter( required = true ) + private String name; + + /** + * The property value to set if the up-to-date condition is fulfilled. + */ + @Parameter( defaultValue = "true" ) + private String value = "true"; + + /** + * The property value to set if the up-to-date condition is not fulfilled. + */ + @Parameter( alias = "else" ) + private String elseValue; + + public UpToDatePropertySetting() + { + } + + public String getName() + { + return name; + } + + public FileSet getFileSet() + { + return fileSet; + } + + public String getValue() + { + return value; + } + + public void setFileSet( FileSet fileSet ) + { + this.fileSet = fileSet; + } + + public void setName( String name ) + { + this.name = name; + } + + public void setValue( String value ) + { + this.value = value; + } + + public String getElse() + { + return elseValue; + } + + public void setElse( String elseValue ) + { + this.elseValue = elseValue; + } + + void validate() + { + if ( StringUtils.isBlank( name ) ) + { + throw new IllegalArgumentException( "name required" ); + } + + if ( StringUtils.isBlank( value ) ) + { + throw new IllegalArgumentException( "value required" ); + } + + if ( StringUtils.equals( value, elseValue ) ) + { + throw new IllegalArgumentException( "value and else cannot be the same" ); + } + + if ( fileSet == null ) + { + throw new IllegalArgumentException( "fileSet required" ); + } + + if ( StringUtils.isBlank( fileSet.getDirectory() ) ) + { + throw new IllegalArgumentException( "directory required for " + fileSet ); + } + + if ( fileSet.getMapper() == null ) + { + throw new IllegalArgumentException( "mapper required for " + fileSet ); + } + } +} \ No newline at end of file diff -Nru build-helper-maven-plugin-1.8/src/main/java/org/codehaus/mojo/buildhelper/versioning/DefaultVersioning.java build-helper-maven-plugin-3.0.0/src/main/java/org/codehaus/mojo/buildhelper/versioning/DefaultVersioning.java --- build-helper-maven-plugin-1.8/src/main/java/org/codehaus/mojo/buildhelper/versioning/DefaultVersioning.java 1970-01-01 00:00:00.000000000 +0000 +++ build-helper-maven-plugin-3.0.0/src/main/java/org/codehaus/mojo/buildhelper/versioning/DefaultVersioning.java 2017-01-29 19:58:46.000000000 +0000 @@ -0,0 +1,121 @@ +package org.codehaus.mojo.buildhelper.versioning; + +/* + * 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 org.apache.maven.artifact.Artifact; + +/** + * @author Karl Heinz Marbaise khmarbaise@apache.org + */ +public class DefaultVersioning + implements Versioning +{ + + private VersionInformation vi; + + private String version; + + private boolean snapshot; + + public DefaultVersioning( String version ) + { + this.version = version; +// if ( version.endsWith( "-" + Artifact.SNAPSHOT_VERSION ) ) +// { +// this.vi = +// new VersionInformation( version.substring( 0, version.length() - Artifact.SNAPSHOT_VERSION.length() ) ); +// this.snapshot = true; +// } +// else +// { + this.vi = new VersionInformation( version ); +// this.snapshot = false; +// } + + } + + public String getVersion() + { + return this.version; + } + + public boolean isSnapshot() + { + return this.snapshot; + } + + @Override + public int getMajor() + { + return this.vi.getMajor(); + } + + @Override + public int getMinor() + { + return this.vi.getMinor(); + } + + @Override + public int getPatch() + { + return this.vi.getPatch(); + } + + @Override + public String getAsOSGiVersion() + { + StringBuffer osgiVersion = new StringBuffer(); + osgiVersion.append( this.getMajor() ); + osgiVersion.append( "." + this.getMinor() ); + osgiVersion.append( "." + this.getPatch() ); + + if ( this.getQualifier() != null || this.getBuildNumber() != 0 ) + { + osgiVersion.append( "." ); + + if ( this.getBuildNumber() != 0 ) + { + osgiVersion.append( this.getBuildNumber() ); + } + if ( this.getQualifier() != null ) + { + // Do not allow having "." in it cause it's not allowed in OSGi. + String qualifier = this.getQualifier().replaceAll( "\\.", "_" ); + osgiVersion.append( qualifier ); + } + } + + return osgiVersion.toString(); + } + + @Override + public int getBuildNumber() + { + return this.vi.getBuildNumber(); + } + + @Override + public String getQualifier() + { + return this.vi.getQualifier(); + } + +} diff -Nru build-helper-maven-plugin-1.8/src/main/java/org/codehaus/mojo/buildhelper/versioning/VersionInformation.java build-helper-maven-plugin-3.0.0/src/main/java/org/codehaus/mojo/buildhelper/versioning/VersionInformation.java --- build-helper-maven-plugin-1.8/src/main/java/org/codehaus/mojo/buildhelper/versioning/VersionInformation.java 1970-01-01 00:00:00.000000000 +0000 +++ build-helper-maven-plugin-3.0.0/src/main/java/org/codehaus/mojo/buildhelper/versioning/VersionInformation.java 2017-01-29 19:58:46.000000000 +0000 @@ -0,0 +1,188 @@ +package org.codehaus.mojo.buildhelper.versioning; + +/* + * The MIT License + * + * Copyright (c) 2016, 2017 Karl Heinz Marbaise + * + * 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. + */ + + +import java.util.regex.Matcher; +import java.util.regex.Pattern; + +import org.codehaus.mojo.buildhelper.ParseVersionMojo; + +/** + * This class will parse the version based on the given pattern in {@link ParseVersionMojo}. + * + * @author Karl Heinz Marbaise khmarbaise@apache.org + * + */ +public class VersionInformation +{ + private static final String MAJOR_MINOR_PATCH_PATTERN = "^((\\d+)(\\.(\\d+)(\\.(\\d+))?)?)"; + + private static final Pattern MAJOR_MINOR_PATCH = Pattern.compile( MAJOR_MINOR_PATCH_PATTERN ); + + private static final Pattern DIGITS = Pattern.compile( MAJOR_MINOR_PATCH_PATTERN + "(.*)$" ); + + private static final Pattern BUILD_NUMBER = Pattern.compile( "(((\\-)(\\d+)(.*))?)|(\\.(.*))|(\\-(.*))|(.*)$" ); + + private int major; + + private int minor; + + private int patch; + + private int buildNumber; + + private String qualifier; + + private void parseBuildNumber( String buildNumberPart ) + { + Matcher matcher = BUILD_NUMBER.matcher( buildNumberPart ); + if ( matcher.matches() ) + { + String buildNumber = matcher.group( 4 ); + String qualifier = matcher.group( 5 ); + + if ( buildNumber != null ) + { + setBuildNumber( Integer.parseInt( buildNumber ) ); + } + + if ( matcher.group( 7 ) != null ) + { + qualifier = matcher.group( 7 ); + } + // Starting with "-" + if ( matcher.group( 9 ) != null ) + { + qualifier = matcher.group( 9 ); + } + if ( qualifier != null ) + { + if ( qualifier.trim().length() == 0 ) + { + setQualifier( null ); + } + else + { + setQualifier( qualifier ); + } + } + else + { + setQualifier( null ); + } + } + } + + private void parseMajorMinorPatchVersion( String version ) + { + Matcher matcher = MAJOR_MINOR_PATCH.matcher( version ); + if ( matcher.matches() ) + { + String majorString = matcher.group( 2 ); + String minorString = matcher.group( 4 ); + String patchString = matcher.group( 6 ); + + if ( majorString != null ) + { + setMajor( Integer.parseInt( majorString ) ); + } + if ( minorString != null ) + { + setMinor( Integer.parseInt( minorString ) ); + } + if ( patchString != null ) + { + setPatch( Integer.parseInt( patchString ) ); + } + } + + } + + public VersionInformation( String version ) + { + Matcher matcherDigits = DIGITS.matcher( version ); + if ( matcherDigits.matches() ) + { + parseMajorMinorPatchVersion( matcherDigits.group( 1 ) ); + parseBuildNumber( matcherDigits.group( 7 ) ); + } + else + { + setQualifier( version ); + } + } + + public int getMajor() + { + return major; + } + + public void setMajor( int major ) + { + this.major = major; + } + + public int getMinor() + { + return minor; + } + + public void setMinor( int minor ) + { + this.minor = minor; + } + + public int getPatch() + { + return patch; + } + + public void setPatch( int patch ) + { + this.patch = patch; + } + + public int getBuildNumber() + { + return buildNumber; + } + + public void setBuildNumber( int buildNumber ) + { + this.buildNumber = buildNumber; + } + + public String getQualifier() + { + return qualifier; + } + + public void setQualifier( String qualifier ) + { + this.qualifier = qualifier; + } + +} \ No newline at end of file diff -Nru build-helper-maven-plugin-1.8/src/main/java/org/codehaus/mojo/buildhelper/versioning/Versioning.java build-helper-maven-plugin-3.0.0/src/main/java/org/codehaus/mojo/buildhelper/versioning/Versioning.java --- build-helper-maven-plugin-1.8/src/main/java/org/codehaus/mojo/buildhelper/versioning/Versioning.java 1970-01-01 00:00:00.000000000 +0000 +++ build-helper-maven-plugin-3.0.0/src/main/java/org/codehaus/mojo/buildhelper/versioning/Versioning.java 2017-01-29 19:58:46.000000000 +0000 @@ -0,0 +1,20 @@ +package org.codehaus.mojo.buildhelper.versioning; + +public interface Versioning +{ + + boolean isSnapshot(); + + int getMajor(); + + int getMinor(); + + int getPatch(); + + String getAsOSGiVersion(); + + int getBuildNumber(); + + String getQualifier(); + +} diff -Nru build-helper-maven-plugin-1.8/src/main/resources/META-INF/m2e/lifecycle-mapping-metadata.xml build-helper-maven-plugin-3.0.0/src/main/resources/META-INF/m2e/lifecycle-mapping-metadata.xml --- build-helper-maven-plugin-1.8/src/main/resources/META-INF/m2e/lifecycle-mapping-metadata.xml 1970-01-01 00:00:00.000000000 +0000 +++ build-helper-maven-plugin-3.0.0/src/main/resources/META-INF/m2e/lifecycle-mapping-metadata.xml 2017-01-29 19:58:46.000000000 +0000 @@ -0,0 +1,48 @@ + + + + + + + add-resource + add-source + add-test-resource + add-test-source + bsh-property + cpu-count + local-ip + maven-version + parse-version + regex-properties + regex-property + released-version + reserve-network-port + timestamp-property + uptodate-properties + uptodate-property + rootlocation + + + + + true + true + + + + + + + attach-artifact + remove-project-artifact + + + + + false + false + + + + + diff -Nru build-helper-maven-plugin-1.8/src/site/apt/index.apt build-helper-maven-plugin-3.0.0/src/site/apt/index.apt --- build-helper-maven-plugin-1.8/src/site/apt/index.apt 2012-09-22 12:25:18.000000000 +0000 +++ build-helper-maven-plugin-3.0.0/src/site/apt/index.apt 2017-01-29 19:58:46.000000000 +0000 @@ -2,8 +2,9 @@ Introduction ------ Dennis Lundberg + Karl Heinz Marbaise ------ - 2012-09-22 + 2016-08-12 ------ ~~ The MIT License @@ -35,6 +36,11 @@ * This plugin contains various small independent goals to assist with the Maven build lifecycle. +* Notes + + Starting with version 3.0.0 this plugin will only support Maven 3+. If you really + need Maven 2+ support you have to use version 1.12 or earlier. + * Goals Overview ~~ General Information about the goals. @@ -51,20 +57,29 @@ * {{{./maven-version-mojo.html}build-helper:maven-version}} Set a property containing the current version of maven. - * {{{./parse-version-mojo.html}build-helper:parse-version}} Set properties containing the parsed components of a version string. - * {{{./regex-property-mojo.html}build-helper:regex-property}} Sets a property by applying a regex replacement rule to a supplied value. + * {{{./regex-properties-mojo.html}build-helper:regex-properties}} Sets a property by applying a regex replacement rule to a supplied value. + * {{{./released-version-mojo.html}build-helper:released-version}} Resolve the latest released version of this project. + * {{{./parse-version-mojo.html}build-helper:parse-version}} Parse the version into different properties. + * {{{./remove-project-artifact-mojo.html}build-helper:remove-project-artifact}} Remove project's artifacts from local repository. * {{{./reserve-network-port-mojo.html}build-helper:reserve-network-port}} Reserve a list of random and unused network ports. * {{{./local-ip-mojo.html}build-helper:local-ip}} Retrieve current host IP address. + * {{{./cpu-count-mojo.html}build-helper:cpu-count}} Retrieve number of available CPU. + * {{{./timestamp-property-mojo.html}build-helper:timestamp-property}} Sets a property based on the current date and time. + * {{{./uptodate-property-mojo.html}build-helper:uptodate-property}} Sets a property according to whether a file set's outputs are up to date with respect to its inputs. + + * {{{./uptodate-properties-mojo.html}build-helper:uptodate-properties}} Sets multiple properties according to whether multiple file sets' outputs are up to date with respect to their inputs. + + * {{{./rootlocation-mojo.html}build-helper:rootlocation}} Sets a property which defines the root folder of a multi module build. * Usage diff -Nru build-helper-maven-plugin-1.8/src/site/apt/usage.apt.vm build-helper-maven-plugin-3.0.0/src/site/apt/usage.apt.vm --- build-helper-maven-plugin-1.8/src/site/apt/usage.apt.vm 2012-04-13 01:16:43.000000000 +0000 +++ build-helper-maven-plugin-3.0.0/src/site/apt/usage.apt.vm 2017-01-29 19:58:46.000000000 +0000 @@ -4,8 +4,10 @@ Dan Tran Dennis Lundberg Robert Scholte + Adrian Price + Karl Heinz Marbaise ------ - 2010-02-12 + 2017-01-29 ------ ~~ The MIT License @@ -216,7 +218,7 @@ org.apache.maven.plugins maven-jar-plugin - 2.2 + 3.0.2 @@ -272,9 +274,31 @@ parsedVersion.buildNumber ------------------- - The property prefix "parsedVersion" can be configured using the <<>> parameter. + Apart from the above properties the following properties will be set: + +------------------- +parsedVersion.nextMajorVersion +parsedVersion.nextMinorVersion +parsedVersion.nextIncrementalVersion +parsedVersion.nextBuildNumber +------------------- + + And another set of properties is set by using the defined formatting. + See {{{./parse-version-mojo.html}build-helper:parse-version}} + +------------------- +formattedVersion.majorVersion +formattedVersion.minorVersion +formattedVersion.incrementalVersion +formattedVersion.buildNumber +formattedVersion.nextMajorVersion +formattedVersion.nextMinorVersion +formattedVersion.nextIncrementalVersion +formattedVersion.nextBuildNumber +------------------- + - <> the behaviour of the parsing is determined by <<>>. + The property prefix <<>> can be configured using the <<>> parameter. An OSGi compatible version will also be created and made available through the property: @@ -283,11 +307,13 @@ ------------------- This property contains the original version string with the first instance of '-' replaced by '.' - For example, <<<1.0.2-beta-1>>> will be converted to <<<1.0.2.beta-1>>>. - + For example, <<<1.0.2-beta-1>>> will be converted to <<<1.0.2.beta-1>>>. Each occurance + of a another `.` will be replaced by `_` cause OSGi does not allow to have more than three `.` + in a version. + * Resolve the latest released version of a project - The <<>> goal can be used to resolve the latest released version of a project. + The <<>> goal can be used to resolve the latest released version of a project. Executing the following plugin configuration makes the latest released version of the current project available. ------------------- @@ -327,7 +353,7 @@ The property prefix "releasedVersion" can be configured using the <<>> parameter. This property can become very handy if you want to provide links to download the latest version. If you have to do a <<>> during snapshot-development, the $\{project.version\} is useless. - + * Remove a project's artifacts from local repository @@ -438,6 +464,56 @@ ------------------- + It is also possible to define port names via resource file(s). Resources in classpath are also supported (artifact + with resource has to be defined in plugin dependencies section). + + <<>> and <<>> parameters can be combined. + +------------------- + + ... + + + + org.codehaus.mojo + build-helper-maven-plugin + ${project.version} + + + jar-with-port-names.txt + [...] + + + + reserve-network-port + + reserve-network-port + + process-resources + + + file://${project.basedir}/names1.txt + classpath:port-names.txt + + + + + + + [...] + + + + +------------------- + port-names.txt: + +------------------- +# Selenium port name +selenium.server.port +# Tomcat port name +tomcat.http.port +------------------- * Set a property by applying a regex replacement to a value @@ -461,7 +537,7 @@ human.version - $\{project.version} + ${project.version} -SNAPSHOT pre-release development version false @@ -479,6 +555,44 @@ the value <<<1.0>>> if the <<>> was <<<1.0>>> but if the project version was <<<1.0-SNAPSHOT>>> then it would have the value <<<1.0 pre-release development version>>>. + To load multiple properties in one execution, use <<>> goal + +------------------- + + ... + + + + org.codehaus.mojo + build-helper-maven-plugin + ${project.version} + + + regex-properties + + regex-properties + + + + + human.version + ${project.version} + -SNAPSHOT + pre-release development version + false + + [....] + + + + + + + + ... + +------------------- + * Set a property based on the current time and date The <<>> goal can be used to set a property to a value based on the current time and date (with @@ -503,7 +617,7 @@ next.year yyyy - year + year +1 @@ -520,7 +634,7 @@ The <<>> parameter accepts any valid <<>> format string. - The <<>> will accept any of: <<>>, <<>>, <<>>, <<>>, <<>>, <<>>, + The <<>> will accept any of: <<>>, <<>>, <<>>, <<>>, <<>>, <<>>, <<>> and <<>>. The <<>> parameter takes integer values only and defaults to <<<0>>>. The <<>> and <<>> parameters can be further used to control the build-time behaviour. @@ -556,3 +670,160 @@ ... ------------------- + +* Retrieve available number of CPUs + + The <<>> goal can be used to load number of CPU + +------------------- + + ... + + + + org.codehaus.mojo + build-helper-maven-plugin + ${project.version} + + + get-cpu-count + + cpu-count + + + + my.cpu.count + + + + + + + ... + +------------------- + +* Set a property according to whether target files are up to date with respect to their sources + + 'Up to date' means that the target file both exists and has a 'last modification timestamp' (<<>>) + equal to or later than that of the corresponding source file(s). + + Source files are computed relative to the <<>>'s required <<>> property. + If the <<>> has an <<>> property, target files are computed relative to that; + otherwise, target files are also computed relative to <<>>. + + The <<>> element supports a <<>>, whose <<>> can be any of the built-in mappers + <<>>. Alternatively, the <<>> property can specify the + fully qualified name of a class that implements <<>>. + + The <<>> goal can be used to set a property to a value if specified target files are up to date. + For example, executing the following plugin configuration to set the <<>> property. + +------------------- + + ... + + + + org.codehaus.mojo + build-helper-maven-plugin + ${project.version} + + + obj-uptodate + + uptodate-property + + + obj.status + fresh + stale + + src/main/c + target/obj + + mod-*/** + + + **/*.old.* + + + glob + *.c + *.o + + + + + + + + + ... + +------------------- + + After the goal executes (by default during the <<>> phase) the <<>> property would have + the value <<>> if all <<>> object files were up to date with respect to their + corresponding <<>> source files (excluding any with <<<.old.>>> in the name); + otherwise, the property would have the value <<>>. + + To set multiple properties for multiple file sets in one execution, use the <<>> goal. + The <<>> element supports all the configuration properties documented above for the + <<>> goal. + +------------------- + + ... + + + + org.codehaus.mojo + build-helper-maven-plugin + ${project.version} + + + lib-doc-uptodate + + uptodate-properties + + + + + lib.uptodate + + target/obj + target/lib + + merge + *.o + mylibrary.so + + + + + doc.uptodate + + src/main/c + target/site/doc + + merge + *.c + mylibrary.html + + + + + + + + + + + ... + +------------------- + + After the goal executes, the <<>> property would have the value <<>> if <<>> + is up to date with respect to all the <<>> object files. Also, the <<>> property would + have the value <<>> if <<>> is up to date with respect to <<>>. diff -Nru build-helper-maven-plugin-1.8/src/site/site.xml build-helper-maven-plugin-3.0.0/src/site/site.xml --- build-helper-maven-plugin-1.8/src/site/site.xml 2009-09-12 12:11:16.000000000 +0000 +++ build-helper-maven-plugin-3.0.0/src/site/site.xml 2017-01-29 19:58:46.000000000 +0000 @@ -16,6 +16,22 @@ --> + + + + www.mojohaus.org + + + 5211 + thin-badge + + + mojohaus/${project.artifactId} + right + gray + + + diff -Nru build-helper-maven-plugin-1.8/src/test/java/org/codehaus/mojo/buildhelper/FixtureUtils.java build-helper-maven-plugin-3.0.0/src/test/java/org/codehaus/mojo/buildhelper/FixtureUtils.java --- build-helper-maven-plugin-1.8/src/test/java/org/codehaus/mojo/buildhelper/FixtureUtils.java 1970-01-01 00:00:00.000000000 +0000 +++ build-helper-maven-plugin-3.0.0/src/test/java/org/codehaus/mojo/buildhelper/FixtureUtils.java 2017-01-29 19:58:46.000000000 +0000 @@ -0,0 +1,132 @@ +package org.codehaus.mojo.buildhelper; + +/* + * The MIT License + * + * Copyright (c) 2004, The Codehaus + * + * 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. + */ + +import java.io.File; +import java.io.FileReader; +import java.io.IOException; +import java.util.Properties; + +/** + * A utility class for managing test resources. + * + * @author Adrian Price demonfiddler@virginmedia.com + * @since 1.12 + */ +public final class FixtureUtils +{ + /** + * Creates test resources defined by the specification file fixture.properties. The method creates all + * the files named by the properties, optionally setting the modification timestamp by adding the number of seconds + * specified by the property value (which must be an integer) to the current system time. + * + * @param basePath The path to the base directory against which to resolve relative paths (including + * fixture.properties). + * @throws IOException If unable to create a file or a missing parent directory. + * @throws NumberFormatException If a non-empty property value cannot be parsed as an integer. + */ + public static void createResources( String basePath ) + throws IOException + { + File baseDir = new File( basePath ); + createResources( baseDir, "fixture.properties", "UTF-8", System.currentTimeMillis() ); + } + + /** + * Creates test resources defined by a specification file. The method creates all the files named by the properties, + * optionally setting the modification timestamp by adding the number of seconds specified by the property value + * (which must be an integer) to a base timestamp. + * + * @param baseDir The base directory against which to resolve relative paths. + * @param propertiesPath The path (relative or absolute) to a Properties file whose property names are + * file paths (relative or absolute) and whose optional property values represent relative modification + * timestamps in seconds. + * @param baseTimestamp The base timestamp to use, in milliseconds since midnight on the 1st January 1970 GMT. + * @param encoding Encoding. + * @throws IOException If unable to create a file or a missing parent directory. + * @throws NumberFormatException If a non-empty property value cannot be parsed as an integer. + */ + public static void createResources( File baseDir, String propertiesPath, String encoding, long baseTimestamp ) + throws IOException + { + createResources( baseDir, new File( baseDir, propertiesPath ), encoding, baseTimestamp ); + } + + /** + * Creates test resources defined by a specification file. The method creates all the files named by the properties, + * optionally setting the modification timestamp by adding the number of seconds specified by the property value + * (which must be an integer) to a base timestamp. + * + * @param baseDir The base directory against which to resolve relative paths. + * @param propertiesFile A Properties file whose property names are file paths (relative or absolute) + * and whose optional property values represent relative modification timestamps in seconds. + * @param encoding Encoding. + * @param baseTimestamp The base timestamp to use, in milliseconds since midnight on the 1st January 1970 GMT. + * @throws IOException If unable to create a file or a missing parent directory. + * @throws NumberFormatException If a non-empty property value cannot be parsed as an integer. + */ + public static void createResources( File baseDir, File propertiesFile, String encoding, long baseTimestamp ) + throws IOException + { + Properties properties = new Properties(); + properties.load( new FileReader( propertiesFile ) ); + createResources( baseDir, properties, baseTimestamp ); + } + + /** + * Creates test resources defined by a specification file. The method creates all the files named by the properties, + * optionally setting the modification timestamp by adding the number of seconds specified by the property value + * (which must be an integer) to a base timestamp. + * + * @param baseDir The base directory against which to resolve relative paths. + * @param properties A Properties object whose property names are file paths (relative or absolute) and + * whose optional property values represent relative modification timestamps in seconds. + * @param baseTimestamp The base timestamp to use, in milliseconds since midnight on the 1st January 1970 GMT. + * @throws IOException If unable to create a file or a missing parent directory. + * @throws NumberFormatException If a non-empty property value cannot be parsed as an integer. + */ + public static void createResources( File baseDir, Properties properties, long baseTimestamp ) + throws IOException + { + for ( String propertyName : properties.stringPropertyNames() ) + { + File file = new File( baseDir, propertyName ); + File parent = file.getParentFile(); + if ( parent != null ) + parent.mkdirs(); + file.createNewFile(); + + // If required, set the last modification timestamp. + String propertyValue = properties.getProperty( propertyName ); + if ( !propertyValue.isEmpty() ) + { + int offset = Integer.parseInt( propertyValue ); + long ts = baseTimestamp + ( offset * 1000 ); + file.setLastModified( ts ); + assert file.lastModified() == ts : "failed to set last modified timestamp for " + + file.getCanonicalPath(); + } + } + } + + private FixtureUtils() + { + } +} diff -Nru build-helper-maven-plugin-1.8/src/test/java/org/codehaus/mojo/buildhelper/ParseVersionTest.java build-helper-maven-plugin-3.0.0/src/test/java/org/codehaus/mojo/buildhelper/ParseVersionTest.java --- build-helper-maven-plugin-1.8/src/test/java/org/codehaus/mojo/buildhelper/ParseVersionTest.java 2012-09-23 10:08:45.000000000 +0000 +++ build-helper-maven-plugin-3.0.0/src/test/java/org/codehaus/mojo/buildhelper/ParseVersionTest.java 2017-01-29 19:58:46.000000000 +0000 @@ -24,12 +24,14 @@ * SOFTWARE. */ +import static org.junit.Assert.assertEquals; + import java.util.Properties; -import junit.framework.TestCase; +import org.testng.annotations.BeforeMethod; +import org.testng.annotations.Test; public class ParseVersionTest - extends TestCase { private static class TestParseVersionMojo extends ParseVersionMojo @@ -40,148 +42,393 @@ { this.properties = properties; } - + protected void defineProperty( String name, String value ) { properties.put( name, value ); } } - public void testParseVersion() - throws Exception + public class TestParseVersion { - Properties props = new Properties(); + private Properties props; + + private ParseVersionMojo mojo; + + @BeforeMethod + public void beforeClass() + { + props = new Properties(); + mojo = new TestParseVersionMojo( props ); + mojo.setPropertyPrefix( "parsed" ); + + mojo.setFormattedPropertyPrefix( "formatted" ); + // The settings should in line with the given defaultValues of the parameters + // in the mojo definition. + mojo.setFormatMajor( "%02d" ); + mojo.setFormatMinor( "%02d" ); + mojo.setFormatIncremental( "%02d" ); + mojo.setFormatBuildNumber( "%02d" ); + } + + @Test + public void testJunkVersion() + throws Exception + { + // Test a junk version string + mojo.parseVersion( "junk" ); + + assertEquals( "0", props.getProperty( "parsed.majorVersion" ) ); + assertEquals( "0", props.getProperty( "parsed.minorVersion" ) ); + assertEquals( "0", props.getProperty( "parsed.incrementalVersion" ) ); + assertEquals( "junk", props.getProperty( "parsed.qualifier" ) ); + assertEquals( "0", props.getProperty( "parsed.buildNumber" ) ); + assertEquals( "0.0.0.junk", props.getProperty( "parsed.osgiVersion" ) ); + } + + @Test + public void testBasicMavenVersionString() + throws Exception + { + // Test a basic maven version string + mojo.parseVersion( "1.0.0" ); + + assertEquals( "1", props.getProperty( "parsed.majorVersion" ) ); + assertEquals( "0", props.getProperty( "parsed.minorVersion" ) ); + assertEquals( "0", props.getProperty( "parsed.incrementalVersion" ) ); + assertEquals( "", props.getProperty( "parsed.qualifier" ) ); + assertEquals( "0", props.getProperty( "parsed.buildNumber" ) ); + assertEquals( "1.0.0", props.getProperty( "parsed.osgiVersion" ) ); + } + + @Test + public void testVersionStringWithQualifier() + { + // Test a version string with qualifier + mojo.parseVersion( "2.3.4-beta-5" ); + + assertEquals( "2", props.getProperty( "parsed.majorVersion" ) ); + assertEquals( "3", props.getProperty( "parsed.minorVersion" ) ); + assertEquals( "4", props.getProperty( "parsed.incrementalVersion" ) ); + assertEquals( "beta-5", props.getProperty( "parsed.qualifier" ) ); + assertEquals( "0", props.getProperty( "parsed.buildNumber" ) ); + assertEquals( "2.3.4.beta-5", props.getProperty( "parsed.osgiVersion" ) ); + } + + @Test + public void testOSGiVersionStringWithQualifier() + { + // Test an osgi version string + mojo.parseVersion( "2.3.4.beta_5" ); + + assertEquals( "2", props.getProperty( "parsed.majorVersion" ) ); + assertEquals( "3", props.getProperty( "parsed.minorVersion" ) ); + assertEquals( "4", props.getProperty( "parsed.incrementalVersion" ) ); + assertEquals( "beta_5", props.getProperty( "parsed.qualifier" ) ); + assertEquals( "0", props.getProperty( "parsed.buildNumber" ) ); + assertEquals( "2.3.4.beta_5", props.getProperty( "parsed.osgiVersion" ) ); + } + + @Test + public void testSnapshotVersion() + { + // Test a snapshot version string + mojo.parseVersion( "1.2.3-SNAPSHOT" ); + + assertEquals( "1", props.getProperty( "parsed.majorVersion" ) ); + assertEquals( "2", props.getProperty( "parsed.minorVersion" ) ); + assertEquals( "3", props.getProperty( "parsed.incrementalVersion" ) ); + assertEquals( "SNAPSHOT", props.getProperty( "parsed.qualifier" ) ); + assertEquals( "0", props.getProperty( "parsed.buildNumber" ) ); + assertEquals( "1.2.3.SNAPSHOT", props.getProperty( "parsed.osgiVersion" ) ); + } + + @Test + public void testSnapshotVersion2() + { + // Test a snapshot version string + mojo.parseVersion( "2.0.17-SNAPSHOT" ); + + assertEquals( "2", props.getProperty( "parsed.majorVersion" ) ); + assertEquals( "0", props.getProperty( "parsed.minorVersion" ) ); + assertEquals( "17", props.getProperty( "parsed.incrementalVersion" ) ); + assertEquals( "SNAPSHOT", props.getProperty( "parsed.qualifier" ) ); + assertEquals( "0", props.getProperty( "parsed.buildNumber" ) ); + assertEquals( "2.0.17.SNAPSHOT", props.getProperty( "parsed.osgiVersion" ) ); + } + + @Test + public void testVersionStringWithBuildNumber() + { + // Test a version string with a build number + mojo.parseVersion( "1.2.3-4" ); + + assertEquals( "1", props.getProperty( "parsed.majorVersion" ) ); + assertEquals( "2", props.getProperty( "parsed.minorVersion" ) ); + assertEquals( "3", props.getProperty( "parsed.incrementalVersion" ) ); + assertEquals( "", props.getProperty( "parsed.qualifier" ) ); + assertEquals( "4", props.getProperty( "parsed.buildNumber" ) ); + assertEquals( "1.2.3.4", props.getProperty( "parsed.osgiVersion" ) ); + + } + + @Test + public void testSnapshotVersionStringWithBuildNumber() + { + // Test a version string with a build number + mojo.parseVersion( "1.2.3-4-SNAPSHOT" ); + + assertEquals( "1", props.getProperty( "parsed.majorVersion" ) ); + assertEquals( "2", props.getProperty( "parsed.minorVersion" ) ); + assertEquals( "3", props.getProperty( "parsed.incrementalVersion" ) ); + assertEquals( "-SNAPSHOT", props.getProperty( "parsed.qualifier" ) ); + assertEquals( "4", props.getProperty( "parsed.buildNumber" ) ); + assertEquals( "1.2.3.4-SNAPSHOT", props.getProperty( "parsed.osgiVersion" ) ); + } + + } + + public class TestParseNextVersion + { + private Properties props; + + private ParseVersionMojo mojo; + + @BeforeMethod + public void beforeClass() + { + props = new Properties(); + mojo = new TestParseVersionMojo( props ); + mojo.setPropertyPrefix( "parsed" ); + mojo.setFormattedPropertyPrefix( "formatted" ); + // The settings should in line with the given defaultValues of the parameters + // in the mojo definition. + mojo.setFormatMajor( "%02d" ); + mojo.setFormatMinor( "%02d" ); + mojo.setFormatIncremental( "%02d" ); + mojo.setFormatBuildNumber( "%02d" ); + } - ParseVersionMojo mojo = new TestParseVersionMojo( props ); - mojo.setPropertyPrefix( "parsed" ); + @Test + public void testJunkVersion() + { + mojo.parseVersion( "junk" ); + + assertEquals( "1", props.getProperty( "parsed.nextMajorVersion" ) ); + assertEquals( "1", props.getProperty( "parsed.nextMinorVersion" ) ); + assertEquals( "1", props.getProperty( "parsed.nextIncrementalVersion" ) ); + assertEquals( "1", props.getProperty( "parsed.nextBuildNumber" ) ); + } + + @Test + public void testBasicMavenVersion() + { + mojo.parseVersion( "1.0.0" ); + + assertEquals( "2", props.getProperty( "parsed.nextMajorVersion" ) ); + assertEquals( "1", props.getProperty( "parsed.nextMinorVersion" ) ); + assertEquals( "1", props.getProperty( "parsed.nextIncrementalVersion" ) ); + assertEquals( "1", props.getProperty( "parsed.nextBuildNumber" ) ); + } + + @Test + public void testVersionStringWithQualifier() + { + mojo.parseVersion( "2.3.4-beta-5" ); + + assertEquals( "3", props.getProperty( "parsed.nextMajorVersion" ) ); + assertEquals( "4", props.getProperty( "parsed.nextMinorVersion" ) ); + assertEquals( "5", props.getProperty( "parsed.nextIncrementalVersion" ) ); + assertEquals( "1", props.getProperty( "parsed.nextBuildNumber" ) ); + } + + @Test + public void testOSGiVersion() + { + mojo.parseVersion( "2.3.4.beta_5" ); + + assertEquals( "3", props.getProperty( "parsed.nextMajorVersion" ) ); + assertEquals( "4", props.getProperty( "parsed.nextMinorVersion" ) ); + assertEquals( "5", props.getProperty( "parsed.nextIncrementalVersion" ) ); + assertEquals( "1", props.getProperty( "parsed.nextBuildNumber" ) ); + } + + @Test + public void testSnapshotVersion() + { + // Test a snapshot version string + mojo.parseVersion( "1.2.3-SNAPSHOT" ); + + assertEquals( "2", props.getProperty( "parsed.nextMajorVersion" ) ); + assertEquals( "3", props.getProperty( "parsed.nextMinorVersion" ) ); + assertEquals( "4", props.getProperty( "parsed.nextIncrementalVersion" ) ); + assertEquals( "1", props.getProperty( "parsed.nextBuildNumber" ) ); + } + + @Test + public void testSnapshotVersion2() + { + // Test a snapshot version string + mojo.parseVersion( "2.0.17-SNAPSHOT" ); - // Test a junk version string - mojo.parseVersion( "junk" ); + assertEquals( "3", props.getProperty( "parsed.nextMajorVersion" ) ); + assertEquals( "1", props.getProperty( "parsed.nextMinorVersion" ) ); + assertEquals( "18", props.getProperty( "parsed.nextIncrementalVersion" ) ); + assertEquals( "1", props.getProperty( "parsed.nextBuildNumber" ) ); + } - assertEquals( "0", props.getProperty( "parsed.majorVersion" ) ); - assertEquals( "0", props.getProperty( "parsed.minorVersion" ) ); - assertEquals( "0", props.getProperty( "parsed.incrementalVersion" ) ); - assertEquals( "junk", props.getProperty( "parsed.qualifier" ) ); - assertEquals( "0", props.getProperty( "parsed.buildNumber" ) ); - assertEquals( "junk", props.getProperty( "parsed.osgiVersion" ) ); - - // Test a basic maven version string - mojo.parseVersion( "1.0.0" ); - - assertEquals( "1", props.getProperty( "parsed.majorVersion" ) ); - assertEquals( "0", props.getProperty( "parsed.minorVersion" ) ); - assertEquals( "0", props.getProperty( "parsed.incrementalVersion" ) ); - assertEquals( "", props.getProperty( "parsed.qualifier" ) ); - assertEquals( "0", props.getProperty( "parsed.buildNumber" ) ); - assertEquals( "1.0.0", props.getProperty( "parsed.osgiVersion" ) ); - - // Test a version string with qualifier - mojo.parseVersion( "2.3.4-beta-5" ); - - assertEquals( "2", props.getProperty( "parsed.majorVersion" ) ); - assertEquals( "3", props.getProperty( "parsed.minorVersion" ) ); - assertEquals( "4", props.getProperty( "parsed.incrementalVersion" ) ); - assertEquals( "beta-5", props.getProperty( "parsed.qualifier" ) ); - assertEquals( "0", props.getProperty( "parsed.buildNumber" ) ); - assertEquals( "2.3.4.beta-5", props.getProperty( "parsed.osgiVersion" ) ); - - // Test an osgi version string - mojo.parseVersion( "2.3.4.beta_5" ); - - assertEquals( "2", props.getProperty( "parsed.majorVersion" ) ); - assertEquals( "3", props.getProperty( "parsed.minorVersion" ) ); - assertEquals( "4", props.getProperty( "parsed.incrementalVersion" ) ); - assertEquals( "beta_5", props.getProperty( "parsed.qualifier" ) ); - assertEquals( "0", props.getProperty( "parsed.buildNumber" ) ); - assertEquals( "2.3.4.beta_5", props.getProperty( "parsed.osgiVersion" ) ); - - // Test a snapshot version string - mojo.parseVersion( "1.2.3-SNAPSHOT" ); - - assertEquals( "1", props.getProperty( "parsed.majorVersion" ) ); - assertEquals( "2", props.getProperty( "parsed.minorVersion" ) ); - assertEquals( "3", props.getProperty( "parsed.incrementalVersion" ) ); - assertEquals( "SNAPSHOT", props.getProperty( "parsed.qualifier" ) ); - assertEquals( "0", props.getProperty( "parsed.buildNumber" ) ); - assertEquals( "1.2.3.SNAPSHOT", props.getProperty( "parsed.osgiVersion" ) ); - - // Test a snapshot version string - mojo.parseVersion( "2.0.17-SNAPSHOT" ); - - assertEquals( "2", props.getProperty( "parsed.majorVersion" ) ); - assertEquals( "0", props.getProperty( "parsed.minorVersion" ) ); - assertEquals( "17", props.getProperty( "parsed.incrementalVersion" ) ); - assertEquals( "SNAPSHOT", props.getProperty( "parsed.qualifier" ) ); - assertEquals( "0", props.getProperty( "parsed.buildNumber" ) ); - assertEquals( "2.0.17.SNAPSHOT", props.getProperty( "parsed.osgiVersion" ) ); - - // Test a version string with a build number - mojo.parseVersion( "1.2.3-4" ); - - assertEquals( "1", props.getProperty( "parsed.majorVersion" ) ); - assertEquals( "2", props.getProperty( "parsed.minorVersion" ) ); - assertEquals( "3", props.getProperty( "parsed.incrementalVersion" ) ); - assertEquals( "", props.getProperty( "parsed.qualifier" ) ); - assertEquals( "4", props.getProperty( "parsed.buildNumber" ) ); - assertEquals( "1.2.3.4", props.getProperty( "parsed.osgiVersion" ) ); + @Test + public void testVersionStringWithBuildNumber() + { + mojo.parseVersion( "1.2.3-4" ); + + assertEquals( "2", props.getProperty( "parsed.nextMajorVersion" ) ); + assertEquals( "3", props.getProperty( "parsed.nextMinorVersion" ) ); + assertEquals( "4", props.getProperty( "parsed.nextIncrementalVersion" ) ); + assertEquals( "5", props.getProperty( "parsed.nextBuildNumber" ) ); + } } - public void testParseVersionNext() - throws Exception + + public class TestFormattedVersion { - Properties props = new Properties(); + private Properties props; - ParseVersionMojo mojo = new TestParseVersionMojo( props ); - mojo.setPropertyPrefix( "parsed" ); + private ParseVersionMojo mojo; - // Test a junk version string - mojo.parseVersion( "junk" ); + @BeforeMethod + public void beforeClass() + { + props = new Properties(); + mojo = new TestParseVersionMojo( props ); + mojo.setPropertyPrefix( "parsed" ); + mojo.setFormattedPropertyPrefix( "formatted" ); + // The settings should in line with the given defaultValues of the parameters + // in the mojo definition. + mojo.setFormatMajor( "%02d" ); + mojo.setFormatMinor( "%02d" ); + mojo.setFormatIncremental( "%02d" ); + mojo.setFormatBuildNumber( "%02d" ); + } - assertEquals( "1", props.getProperty( "parsed.nextMajorVersion" ) ); - assertEquals( "1", props.getProperty( "parsed.nextMinorVersion" ) ); - assertEquals( "1", props.getProperty( "parsed.nextIncrementalVersion" ) ); + @Test + public void testJunkVersion() + { + mojo.parseVersion( "junk" ); - // Test a basic maven version string - mojo.parseVersion( "1.0.0" ); + assertEquals( "00", props.getProperty( "formatted.majorVersion" ) ); + assertEquals( "00", props.getProperty( "formatted.minorVersion" ) ); + assertEquals( "00", props.getProperty( "formatted.incrementalVersion" ) ); + assertEquals( "00", props.getProperty( "formatted.buildNumber" ) ); + + assertEquals( "01", props.getProperty( "formatted.nextMajorVersion" ) ); + assertEquals( "01", props.getProperty( "formatted.nextMinorVersion" ) ); + assertEquals( "01", props.getProperty( "formatted.nextIncrementalVersion" ) ); + assertEquals( "01", props.getProperty( "formatted.nextBuildNumber" ) ); + } - assertEquals( "2", props.getProperty( "parsed.nextMajorVersion" ) ); - assertEquals( "1", props.getProperty( "parsed.nextMinorVersion" ) ); - assertEquals( "1", props.getProperty( "parsed.nextIncrementalVersion" ) ); + @Test + public void testBasicMavenVersion() + { + mojo.parseVersion( "1.0.0" ); - // Test a version string with qualifier - mojo.parseVersion( "2.3.4-beta-5" ); + assertEquals( "01", props.getProperty( "formatted.majorVersion" ) ); + assertEquals( "00", props.getProperty( "formatted.minorVersion" ) ); + assertEquals( "00", props.getProperty( "formatted.incrementalVersion" ) ); + assertEquals( "00", props.getProperty( "formatted.buildNumber" ) ); + + assertEquals( "02", props.getProperty( "formatted.nextMajorVersion" ) ); + assertEquals( "01", props.getProperty( "formatted.nextMinorVersion" ) ); + assertEquals( "01", props.getProperty( "formatted.nextIncrementalVersion" ) ); + assertEquals( "01", props.getProperty( "formatted.nextBuildNumber" ) ); + } - assertEquals( "3", props.getProperty( "parsed.nextMajorVersion" ) ); - assertEquals( "4", props.getProperty( "parsed.nextMinorVersion" ) ); - assertEquals( "5", props.getProperty( "parsed.nextIncrementalVersion" ) ); + @Test + public void testVersionStringWithQualifier() + { + mojo.parseVersion( "2.3.4-beta-5" ); - // Test an osgi version string - mojo.parseVersion( "2.3.4.beta_5" ); + assertEquals( "02", props.getProperty( "formatted.majorVersion" ) ); + assertEquals( "03", props.getProperty( "formatted.minorVersion" ) ); + assertEquals( "04", props.getProperty( "formatted.incrementalVersion" ) ); + assertEquals( "00", props.getProperty( "formatted.buildNumber" ) ); + + assertEquals( "03", props.getProperty( "formatted.nextMajorVersion" ) ); + assertEquals( "04", props.getProperty( "formatted.nextMinorVersion" ) ); + assertEquals( "05", props.getProperty( "formatted.nextIncrementalVersion" ) ); + assertEquals( "01", props.getProperty( "formatted.nextBuildNumber" ) ); - assertEquals( "3", props.getProperty( "parsed.nextMajorVersion" ) ); - assertEquals( "4", props.getProperty( "parsed.nextMinorVersion" ) ); - assertEquals( "5", props.getProperty( "parsed.nextIncrementalVersion" ) ); + } - // Test a snapshot version string - mojo.parseVersion( "1.2.3-SNAPSHOT" ); + @Test + public void testOSGiVersion() + { + mojo.parseVersion( "2.3.4.beta_5" ); - assertEquals( "2", props.getProperty( "parsed.nextMajorVersion" ) ); - assertEquals( "3", props.getProperty( "parsed.nextMinorVersion" ) ); - assertEquals( "4", props.getProperty( "parsed.nextIncrementalVersion" ) ); + assertEquals( "02", props.getProperty( "formatted.majorVersion" ) ); + assertEquals( "03", props.getProperty( "formatted.minorVersion" ) ); + assertEquals( "04", props.getProperty( "formatted.incrementalVersion" ) ); + assertEquals( "00", props.getProperty( "formatted.buildNumber" ) ); + + assertEquals( "03", props.getProperty( "formatted.nextMajorVersion" ) ); + assertEquals( "04", props.getProperty( "formatted.nextMinorVersion" ) ); + assertEquals( "05", props.getProperty( "formatted.nextIncrementalVersion" ) ); + assertEquals( "01", props.getProperty( "formatted.nextBuildNumber" ) ); - // Test a snapshot version string - mojo.parseVersion( "2.0.17-SNAPSHOT" ); + } - assertEquals( "3", props.getProperty( "parsed.nextMajorVersion" ) ); - assertEquals( "1", props.getProperty( "parsed.nextMinorVersion" ) ); - assertEquals( "18", props.getProperty( "parsed.nextIncrementalVersion" ) ); + @Test + public void testSnapshotVersion() + { + // Test a snapshot version string + mojo.parseVersion( "1.2.3-SNAPSHOT" ); - // Test a version string with a build number - mojo.parseVersion( "1.2.3-4" ); + assertEquals( "01", props.getProperty( "formatted.majorVersion" ) ); + assertEquals( "02", props.getProperty( "formatted.minorVersion" ) ); + assertEquals( "03", props.getProperty( "formatted.incrementalVersion" ) ); + assertEquals( "00", props.getProperty( "formatted.buildNumber" ) ); + + assertEquals( "02", props.getProperty( "formatted.nextMajorVersion" ) ); + assertEquals( "03", props.getProperty( "formatted.nextMinorVersion" ) ); + assertEquals( "04", props.getProperty( "formatted.nextIncrementalVersion" ) ); + assertEquals( "01", props.getProperty( "formatted.nextBuildNumber" ) ); + + } + + @Test + public void testSnapshotVersion2() + { + // Test a snapshot version string + mojo.parseVersion( "2.0.17-SNAPSHOT" ); + + assertEquals( "02", props.getProperty( "formatted.majorVersion" ) ); + assertEquals( "00", props.getProperty( "formatted.minorVersion" ) ); + assertEquals( "17", props.getProperty( "formatted.incrementalVersion" ) ); + assertEquals( "00", props.getProperty( "formatted.buildNumber" ) ); + + assertEquals( "03", props.getProperty( "formatted.nextMajorVersion" ) ); + assertEquals( "01", props.getProperty( "formatted.nextMinorVersion" ) ); + assertEquals( "18", props.getProperty( "formatted.nextIncrementalVersion" ) ); + assertEquals( "01", props.getProperty( "formatted.nextBuildNumber" ) ); + } + + @Test + public void testVersionStringWithBuildNumber() + { + mojo.parseVersion( "1.2.3-4" ); + + assertEquals( "01", props.getProperty( "formatted.majorVersion" ) ); + assertEquals( "02", props.getProperty( "formatted.minorVersion" ) ); + assertEquals( "03", props.getProperty( "formatted.incrementalVersion" ) ); + assertEquals( "04", props.getProperty( "formatted.buildNumber" ) ); + + assertEquals( "02", props.getProperty( "formatted.nextMajorVersion" ) ); + assertEquals( "03", props.getProperty( "formatted.nextMinorVersion" ) ); + assertEquals( "04", props.getProperty( "formatted.nextIncrementalVersion" ) ); + assertEquals( "05", props.getProperty( "formatted.nextBuildNumber" ) ); + } - assertEquals( "2", props.getProperty( "parsed.nextMajorVersion" ) ); - assertEquals( "3", props.getProperty( "parsed.nextMinorVersion" ) ); - assertEquals( "4", props.getProperty( "parsed.nextIncrementalVersion" ) ); } + } diff -Nru build-helper-maven-plugin-1.8/src/test/java/org/codehaus/mojo/buildhelper/versioning/VersionInformationTest.java build-helper-maven-plugin-3.0.0/src/test/java/org/codehaus/mojo/buildhelper/versioning/VersionInformationTest.java --- build-helper-maven-plugin-1.8/src/test/java/org/codehaus/mojo/buildhelper/versioning/VersionInformationTest.java 1970-01-01 00:00:00.000000000 +0000 +++ build-helper-maven-plugin-3.0.0/src/test/java/org/codehaus/mojo/buildhelper/versioning/VersionInformationTest.java 2017-01-29 19:58:46.000000000 +0000 @@ -0,0 +1,94 @@ +package org.codehaus.mojo.buildhelper.versioning; + +/* + * 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 static org.assertj.core.api.Assertions.assertThat; + +import org.testng.annotations.DataProvider; +import org.testng.annotations.Test; + +/** + * @author Karl Heinz Marbaise khmarbaise@apache.org + */ +public class VersionInformationTest +{ + + private VersionInformation createVersion( String version ) + { + return new VersionInformation( version ); + } + + private void assertVersion( VersionInformation v, int major, int minor, int patch, int buildNumber, + String qualifier ) + { + assertThat( v.getMajor() ).isEqualTo( major ); + assertThat( v.getMinor() ).isEqualTo( minor ); + assertThat( v.getPatch() ).isEqualTo( patch ); + assertThat( v.getBuildNumber() ).isEqualTo( buildNumber ); + assertThat( v.getQualifier() ).isEqualTo( qualifier ); + } + + // @formatter:off + @DataProvider + public Object[][] createVersions() { + return new Object[][] { + { "1", 1, 0, 0, 0, null }, + { "1-23", 1, 0, 0, 23, null }, + { "1-23.heger", 1, 0, 0, 23, ".heger" }, + { "1.2-45", 1, 2, 0, 45, null }, + { "1.2-45.qual", 1, 2, 0, 45, ".qual" }, + { "1.2-45-qual", 1, 2, 0, 45, "-qual" }, + { "3.2", 3, 2, 0, 0, null }, + { "5.7.1", 5, 7, 1, 0, null }, + { "1.9.04-0012", 1, 9, 4, 12, null }, + { "01.9.04-0012", 1, 9, 4, 12, null }, + { "20.03.5-22", 20, 3, 5, 22, null }, + { "20.03.5-056", 20, 3, 5, 56, null }, + { "20.4.06.0-SNAPSHOT", 20, 4, 6, 0, "0-SNAPSHOT" }, + { "1.2.3-SNAPSHOT", 1, 2, 3, 0, "SNAPSHOT" }, + { "1.2.3-01-SNAPSHOT", 1, 2, 3, 1, "-SNAPSHOT" }, + { "1.2.3-1-SNAPSHOT", 1, 2, 3, 1, "-SNAPSHOT" }, + { "20.03.5.2016060708", 20, 3, 5, 0, "2016060708" }, + { "20.03.5-23-2016060708", 20, 3, 5, 23, "-2016060708" }, + { "20.03.5-23.2016060708", 20, 3, 5, 23, ".2016060708" }, + { "20.03.5-111.anton", 20, 3, 5, 111, ".anton" }, + { "20.03.5.22-SNAPSHOT", 20, 3, 5, 0, "22-SNAPSHOT" }, + { "20.03.5.XYZ.345", 20, 3, 5, 0, "XYZ.345" }, + { "20-88.03.5.XYZ.345", 20, 0, 0, 88, ".03.5.XYZ.345" }, + { "20.4-88.03.5.XYZ.345", 20, 4, 0, 88, ".03.5.XYZ.345" }, + { "020.04-88.03.5.XYZ.345", 20, 4, 0, 88, ".03.5.XYZ.345" }, + { "20.7.12-88.03.5.XYZ.345", 20, 7, 12, 88, ".03.5.XYZ.345" }, + { "20.03.5-111-34-anton", 20, 3, 5, 111, "-34-anton" }, + { "20.03.5-111-34.anton", 20, 3, 5, 111, "-34.anton" }, + { "junk", 0, 0, 0, 0, "junk" }, + { "2.3.4-beta_5", 2, 3, 4, 0, "beta_5" }, + { "2.3.4.beta_5", 2, 3, 4, 0, "beta_5" } + }; + } + // @formatter:on + + @Test( dataProvider = "createVersions" ) + public void checkVersions( String version, int major, int minor, int patch, int buildNumber, String qualifier ) + { + VersionInformation vi = createVersion( version ); + assertVersion( vi, major, minor, patch, buildNumber, qualifier ); + } + +} diff -Nru build-helper-maven-plugin-1.8/.travis.yml build-helper-maven-plugin-3.0.0/.travis.yml --- build-helper-maven-plugin-1.8/.travis.yml 1970-01-01 00:00:00.000000000 +0000 +++ build-helper-maven-plugin-3.0.0/.travis.yml 2017-01-29 19:58:46.000000000 +0000 @@ -0,0 +1,15 @@ +language: java +jdk: + - openjdk7 + - oraclejdk7 + - oraclejdk8 +script: "mvn --show-version --errors --batch-mode -Prun-its clean verify" +cache: + directories: + - $HOME/.m2 +branches: + except: + - gh-pages +notifications: + email: + - olamy@apache.org