build-helper-maven-plugin-1.8/0000775000175000017500000000000012234547251015675 5ustar ebourgebourgbuild-helper-maven-plugin-1.8/src/0000775000175000017500000000000012234547251016464 5ustar ebourgebourgbuild-helper-maven-plugin-1.8/src/it/0000775000175000017500000000000012234547251017100 5ustar ebourgebourgbuild-helper-maven-plugin-1.8/src/it/regex-no-match-keep-original-value-mbuildhelper-54/0000775000175000017500000000000012234547251030454 5ustar ebourgebourg././@LongLink0000644000000000000000000000014612234547251011650 Lustar rootrootbuild-helper-maven-plugin-1.8/src/it/regex-no-match-keep-original-value-mbuildhelper-54/verify.groovybuild-helper-maven-plugin-1.8/src/it/regex-no-match-keep-original-value-mbuildhelper-54/verify.groov0000664000175000017500000000027512122155366033040 0ustar ebourgebourgFile file = new File( basedir, "build.log" ); assert file.exists(); String text = file.getText("utf-8"); assert text.contains("define property propname = \"originalvalue\"") return true; ././@LongLink0000644000000000000000000000015312234547251011646 Lustar rootrootbuild-helper-maven-plugin-1.8/src/it/regex-no-match-keep-original-value-mbuildhelper-54/invoker.propertiesbuild-helper-maven-plugin-1.8/src/it/regex-no-match-keep-original-value-mbuildhelper-54/invoker.prop0000664000175000017500000000006712122155366033034 0ustar ebourgebourginvoker.goals = validate invoker.buildResult = success build-helper-maven-plugin-1.8/src/it/regex-no-match-keep-original-value-mbuildhelper-54/pom.xml0000664000175000017500000000273612122155366031777 0ustar ebourgebourg 4.0.0 org.codehaus.mojo build-helper-mbuildhelper-54 1-SNAPSHOT jar Regex valid with empty replacement Tests no replacement keeps original value. src/main/resources test.properties false src/main/resources test.properties true @project.groupId@ @project.artifactId@ @project.version@ execution1 regex-property propname originalvalue nomatch false build-helper-maven-plugin-1.8/src/it/reserve-ports/0000775000175000017500000000000012234547251021720 5ustar ebourgebourgbuild-helper-maven-plugin-1.8/src/it/reserve-ports/verify.groovy0000664000175000017500000000032612124413432024463 0ustar ebourgebourgFile 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; build-helper-maven-plugin-1.8/src/it/reserve-ports/invoker.properties0000664000175000017500000000006312124413432025501 0ustar ebourgebourginvoker.goals = test invoker.buildResult = success build-helper-maven-plugin-1.8/src/it/reserve-ports/pom.xml0000664000175000017500000000564612124612437023245 0ustar ebourgebourg 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 reserve-ports-to-files process-test-resources reserve-network-port ${project.build.directory}/ports.properties port3 port4 port5 maven-antrun-plugin mk-target-dir compile run echo-reserve-ports test run port1=${port1} port2=${port2} port3=${port3} build-helper-maven-plugin-1.8/src/it/addResource/0000775000175000017500000000000012234547251021340 5ustar ebourgebourgbuild-helper-maven-plugin-1.8/src/it/addResource/src/0000775000175000017500000000000012234547251022127 5ustar ebourgebourgbuild-helper-maven-plugin-1.8/src/it/addResource/src/my-test-resources/0000775000175000017500000000000012234547251025541 5ustar ebourgebourgbuild-helper-maven-plugin-1.8/src/it/addResource/src/my-test-resources/test-resource.txt0000664000175000017500000000003211211754145031075 0ustar ebourgebourgThis is just a text file. build-helper-maven-plugin-1.8/src/it/addResource/src/my-resources/0000775000175000017500000000000012234547251024564 5ustar ebourgebourgbuild-helper-maven-plugin-1.8/src/it/addResource/src/my-resources/resource.txt0000664000175000017500000000003211211754145027143 0ustar ebourgebourgThis is just a text file. build-helper-maven-plugin-1.8/src/it/addResource/pom.xml0000664000175000017500000000313311211754145022651 0ustar ebourgebourg 4.0.0 org.codehaus.mojo build-helper-maven-plugin-add-resource 1.0-SNAPSHOT build-helper-maven-plugin-add-resource package org.codehaus.mojo build-helper-maven-plugin add-resource add-resource src/my-resources my-resources add-test-resource add-test-resource src/my-test-resources my-test-resources build-helper-maven-plugin-1.8/src/it/regex-valid/0000775000175000017500000000000012234547251021307 5ustar ebourgebourgbuild-helper-maven-plugin-1.8/src/it/regex-valid/src/0000775000175000017500000000000012234547251022076 5ustar ebourgebourgbuild-helper-maven-plugin-1.8/src/it/regex-valid/src/main/0000775000175000017500000000000012234547251023022 5ustar ebourgebourgbuild-helper-maven-plugin-1.8/src/it/regex-valid/src/main/resources/0000775000175000017500000000000012234547251025034 5ustar ebourgebourgbuild-helper-maven-plugin-1.8/src/it/regex-valid/src/main/resources/test.properties0000664000175000017500000000003011604335367030125 0ustar ebourgebourgversion=${build.version}build-helper-maven-plugin-1.8/src/it/regex-valid/invoker.properties0000664000175000017500000000002611604335367025103 0ustar ebourgebourginvoker.goals=compile build-helper-maven-plugin-1.8/src/it/regex-valid/verify.bsh0000664000175000017500000000070311604335367023314 0ustar ebourgebourgimport 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; build-helper-maven-plugin-1.8/src/it/regex-valid/pom.xml0000664000175000017500000000315711604335367022635 0ustar ebourgebourg 4.0.0 org.codehaus.mojo build-helper-maven-plugin-regex-valid-it 1-SNAPSHOT jar Regex Valid 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-property build.version ${project.version} -SNAPSHOT -RC false build-helper-maven-plugin-1.8/src/it/reserve-ports-with-min/0000775000175000017500000000000012234547251023452 5ustar ebourgebourgbuild-helper-maven-plugin-1.8/src/it/reserve-ports-with-min/verify.groovy0000664000175000017500000000067412124413432026223 0ustar ebourgebourgFile file = new File( basedir, "build.log" ); assert file.exists(); String text = file.getText("utf-8"); assert text.contains("port1=30000") assert text.contains("port2=30001") assert text.contains("port3=30002") assert text.contains("port4=30003") assert text.contains("port5=30004") assert text.contains("port6=30005") assert text.contains("port7=40000") assert text.contains("port8=40001") assert text.contains("port9=40002") return true; build-helper-maven-plugin-1.8/src/it/reserve-ports-with-min/invoker.properties0000664000175000017500000000006312124413432027233 0ustar ebourgebourginvoker.goals = test invoker.buildResult = success build-helper-maven-plugin-1.8/src/it/reserve-ports-with-min/pom.xml0000664000175000017500000000726312124612437024774 0ustar ebourgebourg 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 30000 reserve-ports2 process-test-resources reserve-network-port port4 port5 port6 30000 reserve-ports3 process-test-resources reserve-network-port port7 port8 port9 40000 maven-antrun-plugin mk-target-dir compile run echo-reserve-ports test run port1=${port1} port2=${port2} port3=${port3} port4=${port4} port5=${port5} port6=${port6} port7=${port7} port8=${port8} port9=${port9} build-helper-maven-plugin-1.8/src/it/reserve-ports-with-min-root-range/0000775000175000017500000000000012234547251025525 5ustar ebourgebourgbuild-helper-maven-plugin-1.8/src/it/reserve-ports-with-min-root-range/verify.groovy0000664000175000017500000000053012124603552030271 0ustar ebourgebourgFile 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=1024") assert text.contains("port2=1025") assert text.contains("port3=1026") return true; build-helper-maven-plugin-1.8/src/it/reserve-ports-with-min-root-range/invoker.properties0000664000175000017500000000006312124603552031312 0ustar ebourgebourginvoker.goals = test invoker.buildResult = success build-helper-maven-plugin-1.8/src/it/reserve-ports-with-min-root-range/pom.xml0000664000175000017500000000463412124612437027046 0ustar ebourgebourg 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 800 maven-antrun-plugin mk-target-dir compile run echo-reserve-ports test run port1=${port1} port2=${port2} port3=${port3} build-helper-maven-plugin-1.8/src/it/surefire/0000775000175000017500000000000012234547251020724 5ustar ebourgebourgbuild-helper-maven-plugin-1.8/src/it/surefire/src/0000775000175000017500000000000012234547251021513 5ustar ebourgebourgbuild-helper-maven-plugin-1.8/src/it/surefire/src/test/0000775000175000017500000000000012234547251022472 5ustar ebourgebourgbuild-helper-maven-plugin-1.8/src/it/surefire/src/test/java/0000775000175000017500000000000012234547251023413 5ustar ebourgebourgbuild-helper-maven-plugin-1.8/src/it/surefire/src/test/java/org/0000775000175000017500000000000012234547251024202 5ustar ebourgebourgbuild-helper-maven-plugin-1.8/src/it/surefire/src/test/java/org/codehaus/0000775000175000017500000000000012234547251025775 5ustar ebourgebourgbuild-helper-maven-plugin-1.8/src/it/surefire/src/test/java/org/codehaus/mojo/0000775000175000017500000000000012234547251026741 5ustar ebourgebourg././@LongLink0000644000000000000000000000016212234547251011646 Lustar rootrootbuild-helper-maven-plugin-1.8/src/it/surefire/src/test/java/org/codehaus/mojo/PassReservedPortToSureFireTest.javabuild-helper-maven-plugin-1.8/src/it/surefire/src/test/java/org/codehaus/mojo/PassReservedPortToSure0000664000175000017500000000142511146102603033270 0ustar ebourgebourgpackage org.codehaus.mojo; import java.io.File; import junit.framework.TestCase; public class PassReservedPortToSureFireTest extends TestCase { public void testCheckSystemProperties() throws Exception { String port = System.getProperty( "port1" ); Integer.parseInt( port ); } public void testCheckEnvironment() throws Exception { String port = System.getenv( "port1" ); Integer.parseInt( port ); } public void testCheckEnvironmentUsingMavenProject() throws Exception { String env = System.getenv( "targetDir" ); String expectEnv = new File( System.getProperty( "basedir", "." ), "target" ).getAbsolutePath(); assertEquals( expectEnv, env ); } } build-helper-maven-plugin-1.8/src/it/surefire/src/test/java/org/codehaus/mojo/build-helper/0000775000175000017500000000000012234547251031315 5ustar ebourgebourgbuild-helper-maven-plugin-1.8/src/it/surefire/pom.xml0000664000175000017500000000441011577732663022254 0ustar ebourgebourg 4.0.0 org.codehaus.mojo test-reserve-port-with-surefire 1.0-SNAPSHOT test-reserve-port-with-surefire junit junit 3.8.1 test package org.codehaus.mojo build-helper-maven-plugin reserve-ports process-test-resources reserve-network-port port1 port2 port3 maven-surefire-plugin 2.9 port1 ${port1} ${port1} ${project.build.directory} build-helper-maven-plugin-1.8/src/it/timestamp-valid/0000775000175000017500000000000012234547251022200 5ustar ebourgebourgbuild-helper-maven-plugin-1.8/src/it/timestamp-valid/src/0000775000175000017500000000000012234547251022767 5ustar ebourgebourgbuild-helper-maven-plugin-1.8/src/it/timestamp-valid/src/main/0000775000175000017500000000000012234547251023713 5ustar ebourgebourgbuild-helper-maven-plugin-1.8/src/it/timestamp-valid/src/main/resources/0000775000175000017500000000000012234547251025725 5ustar ebourgebourgbuild-helper-maven-plugin-1.8/src/it/timestamp-valid/src/main/resources/test.properties0000664000175000017500000000002411604340021031000 0ustar ebourgebourgversion=${timestamp}build-helper-maven-plugin-1.8/src/it/timestamp-valid/invoker.properties0000664000175000017500000000002611604340021025753 0ustar ebourgebourginvoker.goals=compile build-helper-maven-plugin-1.8/src/it/timestamp-valid/verify.bsh0000664000175000017500000000071511604340021024167 0ustar ebourgebourgimport 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( "${timestamp}" ) >= 0 ) { System.err.println( "Timestamp not set" ); return false; } } catch( Throwable t ) { t.printStackTrace(); return false; } return true; build-helper-maven-plugin-1.8/src/it/timestamp-valid/pom.xml0000664000175000017500000000272211604340021023502 0ustar ebourgebourg 4.0.0 localdomain.localhost timestamp-valid 1-SNAPSHOT jar Timestamp Valid Tests that a valid timestamp gets generated src/main/resources test.properties false src/main/resources test.properties true @project.groupId@ @project.artifactId@ @project.version@ timestamp-property timestamp en_US build-helper-maven-plugin-1.8/src/it/mbuildhelper-53/0000775000175000017500000000000012234547251022001 5ustar ebourgebourgbuild-helper-maven-plugin-1.8/src/it/mbuildhelper-53/verify.groovy0000664000175000017500000000026412122152525024546 0ustar ebourgebourgFile file = new File( basedir, "build.log" ); assert file.exists(); String text = file.getText("utf-8"); assert text.contains("define property propname = \"hi \"") return true; build-helper-maven-plugin-1.8/src/it/mbuildhelper-53/invoker.properties0000664000175000017500000000006712122152525025567 0ustar ebourgebourginvoker.goals = validate invoker.buildResult = success build-helper-maven-plugin-1.8/src/it/mbuildhelper-53/pom.xml0000664000175000017500000000275612123663212023321 0ustar ebourgebourg 4.0.0 org.codehaus.mojo build-helper-mbuildhelper-53 1-SNAPSHOT jar Regex valid with empty replacement Tests that an empty replacement works (previously failing as if replacement was not specified). src/main/resources test.properties false src/main/resources test.properties true @project.groupId@ @project.artifactId@ @project.version@ regex-property propname hi you you false build-helper-maven-plugin-1.8/src/it/timestamp-regex/0000775000175000017500000000000012234547251022213 5ustar ebourgebourgbuild-helper-maven-plugin-1.8/src/it/timestamp-regex/src/0000775000175000017500000000000012234547251023002 5ustar ebourgebourgbuild-helper-maven-plugin-1.8/src/it/timestamp-regex/src/main/0000775000175000017500000000000012234547251023726 5ustar ebourgebourgbuild-helper-maven-plugin-1.8/src/it/timestamp-regex/src/main/resources/0000775000175000017500000000000012234547251025740 5ustar ebourgebourgbuild-helper-maven-plugin-1.8/src/it/timestamp-regex/src/main/resources/test.properties0000664000175000017500000000003011604340021031010 0ustar ebourgebourgversion=${build.version}build-helper-maven-plugin-1.8/src/it/timestamp-regex/invoker.properties0000664000175000017500000000002611604340021025766 0ustar ebourgebourginvoker.goals=compile build-helper-maven-plugin-1.8/src/it/timestamp-regex/verify.bsh0000664000175000017500000000131711604340021024201 0ustar ebourgebourgimport java.io.*; import java.util.*; import java.util.regex.*; 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( "${build.version}" ) >= 0 ) { System.err.println( "Timestamp not set" ); return false; } Pattern regex = Pattern.compile( "\\d\\d:\\d\\d \\d\\d-\\d\\d-\\d\\d\\d\\d" ); if ( !regex.matcher( value ).find() ) { System.err.println( "Formatted timestamp not in property" ); return false; } } catch( Throwable t ) { t.printStackTrace(); return false; } return true; build-helper-maven-plugin-1.8/src/it/timestamp-regex/pom.xml0000664000175000017500000000377011604340021023521 0ustar ebourgebourg 4.0.0 localdomain.localhost timestamp-jenkins 1-SNAPSHOT jar Timestamp Jenkins Tests that a jenkins style timestamp can be set src/main/resources test.properties false src/main/resources test.properties true @project.groupId@ @project.artifactId@ @project.version@ timestamp timestamp-property timestamp en_US hh:mm dd-MM-yyyy version regex-property build.version ${project.version} -SNAPSHOT -RC (${timestamp} private) false build-helper-maven-plugin-1.8/src/it/regex-nomatch/0000775000175000017500000000000012234547251021641 5ustar ebourgebourgbuild-helper-maven-plugin-1.8/src/it/regex-nomatch/src/0000775000175000017500000000000012234547251022430 5ustar ebourgebourgbuild-helper-maven-plugin-1.8/src/it/regex-nomatch/src/main/0000775000175000017500000000000012234547251023354 5ustar ebourgebourgbuild-helper-maven-plugin-1.8/src/it/regex-nomatch/src/main/resources/0000775000175000017500000000000012234547251025366 5ustar ebourgebourgbuild-helper-maven-plugin-1.8/src/it/regex-nomatch/src/main/resources/test.properties0000664000175000017500000000003011604335367030457 0ustar ebourgebourgversion=${build.version}build-helper-maven-plugin-1.8/src/it/regex-nomatch/invoker.properties0000664000175000017500000000006711604335367025442 0ustar ebourgebourginvoker.goals = validate invoker.buildResult = failure build-helper-maven-plugin-1.8/src/it/regex-nomatch/pom.xml0000664000175000017500000000320111604335367023155 0ustar ebourgebourg 4.0.0 org.codehaus.mojo build-helper-maven-plugin-regex-nomatch-it 1-SNAPSHOT jar Regex NoMatch Tests that failOfNoMatch will fail if no match src/main/resources test.properties false src/main/resources test.properties true @project.groupId@ @project.artifactId@ @project.version@ regex-property build.version ${project.version} NOT HERE Substitute true build-helper-maven-plugin-1.8/src/it/settings.xml0000664000175000017500000000374111577734143021476 0ustar ebourgebourg it-repo true local.central @localRepositoryUrl@ true true codehaus.snapshots Codehaus Snapshot Repository http://snapshots.repository.codehaus.org/ false true local.central @localRepositoryUrl@ true true build-helper-maven-plugin-1.8/src/it/regex-invalid/0000775000175000017500000000000012234547251021636 5ustar ebourgebourgbuild-helper-maven-plugin-1.8/src/it/regex-invalid/src/0000775000175000017500000000000012234547251022425 5ustar ebourgebourgbuild-helper-maven-plugin-1.8/src/it/regex-invalid/src/main/0000775000175000017500000000000012234547251023351 5ustar ebourgebourgbuild-helper-maven-plugin-1.8/src/it/regex-invalid/src/main/resources/0000775000175000017500000000000012234547251025363 5ustar ebourgebourgbuild-helper-maven-plugin-1.8/src/it/regex-invalid/src/main/resources/test.properties0000664000175000017500000000003011604335367030454 0ustar ebourgebourgversion=${build.version}build-helper-maven-plugin-1.8/src/it/regex-invalid/invoker.properties0000664000175000017500000000006711604335367025437 0ustar ebourgebourginvoker.goals = validate invoker.buildResult = failure build-helper-maven-plugin-1.8/src/it/regex-invalid/pom.xml0000664000175000017500000000317111604335367023160 0ustar ebourgebourg 4.0.0 org.codehaus.mojo build-helper-maven-plugin-regex-invalid-it 1-SNAPSHOT jar Regex Invalid Tests that a invalid regex fails the build src/main/resources test.properties false src/main/resources test.properties true @project.groupId@ @project.artifactId@ @project.version@ regex-property build.version ${project.version} -S(NAPSHOT -$1 false build-helper-maven-plugin-1.8/src/it/bsh-property/0000775000175000017500000000000012234547251021536 5ustar ebourgebourgbuild-helper-maven-plugin-1.8/src/it/bsh-property/invoker.properties0000664000175000017500000000003112027714326025322 0ustar ebourgebourginvoker.goals = validate build-helper-maven-plugin-1.8/src/it/bsh-property/pom.xml0000664000175000017500000000271412027714326023056 0ustar ebourgebourg 4.0.0 org.codehaus.mojo build-helper-maven-plugin-bsh-property-it 1-SNAPSHOT jar bsh-property IT Tests that a Beanshell script can be run, access project, session and settings, and define properties. @project.groupId@ @project.artifactId@ @project.version@ bsh-property name root local name = project.getName(); root = session.getExecutionRootDirectory(); local = settings.getLocalRepository(); plexus = session.getContainer(); build-helper-maven-plugin-1.8/src/site/0000775000175000017500000000000012234547251017430 5ustar ebourgebourgbuild-helper-maven-plugin-1.8/src/site/site.xml0000664000175000017500000000200711252707744021121 0ustar ebourgebourg build-helper-maven-plugin-1.8/src/site/apt/0000775000175000017500000000000012234547251020214 5ustar ebourgebourgbuild-helper-maven-plugin-1.8/src/site/apt/usage.apt.vm0000664000175000017500000004050111741677173022460 0ustar ebourgebourg ------ Usage ------ Dan Tran Dennis Lundberg Robert Scholte ------ 2010-02-12 ------ ~~ 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. Usage Brief examples on how to use the Build Helper Maven Plugin's goals. * Add more source directories to your project Use this example to add more source directories to your project, since <<>> only allows one source directory. ------------------- ... org.codehaus.mojo build-helper-maven-plugin ${project.version} add-source generate-sources add-source some directory ... ------------------- * Add more test source directories to your project The same as the previous example, but this time we add more test source directories to your project. ------------------- ... org.codehaus.mojo build-helper-maven-plugin ${project.version} add-test-source generate-test-sources add-test-source some directory ... ------------------- * Add more resource directories to your project This example shows how to add additional resource directories to your project. Another goal called <<>> can be used in a similar way to add test resources to the project. ------------------- ... org.codehaus.mojo build-helper-maven-plugin ${project.version} add-resource generate-resources add-resource src/my-resources my-resources **/junk/** ------------------- * Attach additional artifacts to your project Typically run after <<>>, or another plugin, that produces files that you want to attach to the project for install and deploy. ------------------- ... ... org.codehaus.mojo build-helper-maven-plugin ${project.version} attach-artifacts package attach-artifact some file extension of your file optional ... ------------------- * Set the current version of Maven in a property This can be used to keep track of what version of Maven was used to build a particular artifact. For example, the following POM sets the property and then uses the property to save the Maven version to the project JAR's manifest. ------------------- ... org.codehaus.mojo build-helper-maven-plugin ${project.version} maven-version maven-version org.apache.maven.plugins maven-jar-plugin 2.2 ${maven.version} ... ------------------- * Access the parsed components of a project version The <<>> goal can be used to access the component parts of a version string. For example, the major version or the qualifier by themselves. Executing the following plugin configuration will parse the version of the current project and set several properties. ------------------- ... org.codehaus.mojo build-helper-maven-plugin ${project.version} parse-version parse-version ... ------------------- After the goal executes (by default during the <<>> phase) the following properties will contain the components of the current project version. ------------------- parsedVersion.majorVersion parsedVersion.minorVersion parsedVersion.incrementalVersion parsedVersion.qualifier parsedVersion.buildNumber ------------------- The property prefix "parsedVersion" can be configured using the <<>> parameter. <> the behaviour of the parsing is determined by <<>>. An OSGi compatible version will also be created and made available through the property: ------------------- parsedVersion.osgiVersion ------------------- 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>>>. * 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. ------------------- ... org.codehaus.mojo build-helper-maven-plugin ${project.version} released-version released-version ... ------------------- After the goal executes (by default during the <<>> phase) the following property will be available. ------------------- releasedVersion.version releasedVersion.majorVersion releasedVersion.minorVersion releasedVersion.incrementalVersion ------------------- 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 Mainly used to remove previously installed large project artifacts in the local repository before the <<>> phase starts. The example below removes all the project's artifacts including all versions from the local repository at the implicit <<>> phase. To remove only the current version, set the \<<<>>> configuration element to <<>>. ------------------- ... org.codehaus.mojo build-helper-maven-plugin ${project.version} remove-old-installers remove-project-artifact true ------------------- * Reserve a list of random and unused network ports Use this plugin to reserve a set of available unused network ports to be placed in a given property set, so that they can be inserted into other plugin configurations. The example below shows how one can pass in random ports to Selenium server port and Tomcat http port. Useful for running multiple tests concurrently. ------------------- ... org.codehaus.mojo build-helper-maven-plugin ${project.version} reserve-network-port reserve-network-port process-resources selenium.server.port tomcat.http.port org.codehaus.mojo selenium-maven-plugin start-selenium test start-server ${selenium.server.port} [...] org.codehaus.mojo tomcat-maven-plugin run-tomcat test run ${tomcat.http.port} [...] [...] ------------------- * Set a property by applying a regex replacement to a value The <<>> goal can be used to set a property to a value after regex replacement has been applied. For example, executing the following plugin configuration to set the <<>> property. ------------------- ... org.codehaus.mojo build-helper-maven-plugin ${project.version} regex-property regex-property human.version $\{project.version} -SNAPSHOT pre-release development version false ... ------------------- After the goal executes (by default during the <<>> phase) the <<>> property would have 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>>>. * 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 an optional offset applied). For example, executing the following plugin configuration to set the <<>> property to next year. ------------------- ... org.codehaus.mojo build-helper-maven-plugin ${project.version} timestamp-property timestamp-property next.year yyyy year +1 ... ------------------- After the goal executes (by default during the <<>> phase) the <<>> property will have the value of next year. The <<>> parameter accepts any valid <<>> format string. 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. * Retrieve current host IP address The <<>> goal can be used to load current host address ------------------- ... org.codehaus.mojo build-helper-maven-plugin ${project.version} get-local-ip local-ip my.local.ip ... ------------------- build-helper-maven-plugin-1.8/src/site/apt/index.apt0000664000175000017500000000650012027327056022031 0ustar ebourgebourg ------ Introduction ------ Dennis Lundberg ------ 2012-09-22 ------ ~~ 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. Build Helper Maven Plugin ~~ Plugin introduction, description, and other relevant information. * This plugin contains various small independent goals to assist with the Maven build lifecycle. * Goals Overview ~~ General Information about the goals. * {{{./add-source-mojo.html}build-helper:add-source}} Add more source directories to the POM. * {{{./add-test-source-mojo.html}build-helper:add-test-source}} Add test source directories to the POM. * {{{./add-resource-mojo.html}build-helper:add-resource}} Add more resource directories to the POM. * {{{./add-test-resource-mojo.html}build-helper:add-test-resource}} Add test resource directories to the POM. * {{{./attach-artifact-mojo.html}build-helper:attach-artifact}} Attach additional artifacts to be installed and deployed. * {{{./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. * {{{./released-version-mojo.html}build-helper:released-version}} Resolve the latest released version of this project. * {{{./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. * {{{./timestamp-property-mojo.html}build-helper:timestamp-property}} Sets a property based on the current date and time. * Usage Instructions on how to use the Build Helper Maven Plugin can be found on the {{{./usage.html}usage page}}. * Examples * {{{http://svn.codehaus.org/mojo/trunk/mojo/build-helper-maven-plugin/src/it/reserve-ports/pom.xml} Reserve network port}} * {{{http://svn.codehaus.org/mojo/trunk/mojo/build-helper-maven-plugin/src/it/surefire/pom.xml} Passing reserve port to Surefire}} build-helper-maven-plugin-1.8/src/test/0000775000175000017500000000000012234547251017443 5ustar ebourgebourgbuild-helper-maven-plugin-1.8/src/test/java/0000775000175000017500000000000012234547251020364 5ustar ebourgebourgbuild-helper-maven-plugin-1.8/src/test/java/org/0000775000175000017500000000000012234547251021153 5ustar ebourgebourgbuild-helper-maven-plugin-1.8/src/test/java/org/codehaus/0000775000175000017500000000000012234547251022746 5ustar ebourgebourgbuild-helper-maven-plugin-1.8/src/test/java/org/codehaus/mojo/0000775000175000017500000000000012234547251023712 5ustar ebourgebourgbuild-helper-maven-plugin-1.8/src/test/java/org/codehaus/mojo/buildhelper/0000775000175000017500000000000012234547251026211 5ustar ebourgebourgbuild-helper-maven-plugin-1.8/src/test/java/org/codehaus/mojo/buildhelper/ParseVersionTest.java0000664000175000017500000002003612027557655032346 0ustar ebourgebourgpackage 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.Properties; import junit.framework.TestCase; public class ParseVersionTest extends TestCase { private static class TestParseVersionMojo extends ParseVersionMojo { private Properties properties; public TestParseVersionMojo( Properties properties ) { this.properties = properties; } protected void defineProperty( String name, String value ) { properties.put( name, value ); } } public void testParseVersion() throws Exception { Properties props = new Properties(); ParseVersionMojo mojo = new TestParseVersionMojo( props ); mojo.setPropertyPrefix( "parsed" ); // 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( "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" ) ); } public void testParseVersionNext() throws Exception { Properties props = new Properties(); ParseVersionMojo mojo = new TestParseVersionMojo( props ); mojo.setPropertyPrefix( "parsed" ); // Test a junk version string mojo.parseVersion( "junk" ); assertEquals( "1", props.getProperty( "parsed.nextMajorVersion" ) ); assertEquals( "1", props.getProperty( "parsed.nextMinorVersion" ) ); assertEquals( "1", props.getProperty( "parsed.nextIncrementalVersion" ) ); // Test a basic maven version string mojo.parseVersion( "1.0.0" ); assertEquals( "2", props.getProperty( "parsed.nextMajorVersion" ) ); assertEquals( "1", props.getProperty( "parsed.nextMinorVersion" ) ); assertEquals( "1", props.getProperty( "parsed.nextIncrementalVersion" ) ); // Test a version string with qualifier 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" ) ); // Test an osgi version string 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" ) ); // 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" ) ); // 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 a version string with a build number mojo.parseVersion( "1.2.3-4" ); assertEquals( "2", props.getProperty( "parsed.nextMajorVersion" ) ); assertEquals( "3", props.getProperty( "parsed.nextMinorVersion" ) ); assertEquals( "4", props.getProperty( "parsed.nextIncrementalVersion" ) ); } } build-helper-maven-plugin-1.8/src/main/0000775000175000017500000000000012234547251017410 5ustar ebourgebourgbuild-helper-maven-plugin-1.8/src/main/java/0000775000175000017500000000000012234547251020331 5ustar ebourgebourgbuild-helper-maven-plugin-1.8/src/main/java/org/0000775000175000017500000000000012234547251021120 5ustar ebourgebourgbuild-helper-maven-plugin-1.8/src/main/java/org/codehaus/0000775000175000017500000000000012234547251022713 5ustar ebourgebourgbuild-helper-maven-plugin-1.8/src/main/java/org/codehaus/mojo/0000775000175000017500000000000012234547251023657 5ustar ebourgebourgbuild-helper-maven-plugin-1.8/src/main/java/org/codehaus/mojo/buildhelper/0000775000175000017500000000000012234547251026156 5ustar ebourgebourgbuild-helper-maven-plugin-1.8/src/main/java/org/codehaus/mojo/buildhelper/RegexPropertyMojo.java0000664000175000017500000000712212124600017032453 0ustar ebourgebourgpackage 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.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 { /** * 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; /** * {@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..." ); } } defineProperty( name, value ); } } build-helper-maven-plugin-1.8/src/main/java/org/codehaus/mojo/buildhelper/AddTestResourceMojo.java0000664000175000017500000000364712027417451032716 0ustar ebourgebourgpackage 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.model.Resource; import org.apache.maven.plugins.annotations.LifecyclePhase; import org.apache.maven.plugins.annotations.Mojo; /** * Add more test resource directories to the POM. * * @author Paul Gier * @version $Id: AddTestResourceMojo.java 17586 2012-09-22 20:27:21Z hboutemy $ * @since 1.3 */ @Mojo( name = "add-test-resource", defaultPhase = LifecyclePhase.GENERATE_TEST_RESOURCES, threadSafe = true ) public class AddTestResourceMojo extends AbstractAddResourceMojo { public void addResource( Resource resource ) { getProject().addTestResource( resource ); if ( getLog().isDebugEnabled() ) { getLog().debug( "Added test resource: " + resource.getDirectory() ); } } } build-helper-maven-plugin-1.8/src/main/java/org/codehaus/mojo/buildhelper/TimestampPropertyMojo.java0000664000175000017500000001433012027557655033370 0ustar ebourgebourgpackage 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 java.text.DateFormat; import java.text.SimpleDateFormat; import java.util.Calendar; import java.util.Date; import java.util.GregorianCalendar; import java.util.Locale; import java.util.TimeZone; /** * 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 ) public class TimestampPropertyMojo extends AbstractDefinePropertyMojo { /** * The property to set. */ @Parameter( required = true ) private String name; /** * The date/time pattern to be used. The values are as defined by the Java SimpleDateFormat class. */ @Parameter private String pattern; /** * The timezone to use for displaying time. The values are as defined by the Java {$link TimeZone} class. */ @Parameter( defaultValue = "GMT" ) private String timeZone; /** * An offset to apply to the current time. */ @Parameter( defaultValue = "0" ) private int offset; /** * The unit of the offset to be applied to the current time. Valid Values are *
    *
  • millisecond
  • *
  • second
  • *
  • minute
  • *
  • hour
  • *
  • day
  • *
  • week
  • *
  • month
  • *
  • year
  • *
*/ @Parameter( defaultValue = "second" ) private String unit; /** * The locale to use, for example en,US. */ @Parameter private String locale; /** * {@inheritDoc} */ public void execute() throws MojoExecutionException, MojoFailureException { Locale locale; if ( this.locale != null ) { String[] bits = this.locale.split( "[,_]" ); if ( bits.length == 1 ) { locale = new Locale( bits[0].trim() ); } else if ( bits.length == 2 ) { locale = new Locale( bits[0].trim(), bits[1].trim() ); } else if ( bits.length == 3 ) { locale = new Locale( bits[0].trim(), bits[1].trim(), bits[2].trim() ); } else { throw new MojoExecutionException( "expecting language,country,variant but got more than three parts" ); } } else { locale = Locale.getDefault(); getLog().warn( "Using platform locale (" + locale.toString() + " actually) to format date/time, i.e. build is platform dependent!" ); } DateFormat format; if ( pattern == null ) { format = DateFormat.getDateTimeInstance( DateFormat.SHORT, DateFormat.SHORT, locale ); } else { try { format = new SimpleDateFormat( pattern, locale ); } catch ( IllegalArgumentException e ) { throw new MojoExecutionException( e.getMessage(), e ); } } TimeZone timeZone; if ( this.timeZone != null ) { timeZone = TimeZone.getTimeZone( this.timeZone ); } else { timeZone = TimeZone.getTimeZone( "GMT" ); } Date now = new Date(); Calendar calendar = new GregorianCalendar(); calendar.setTime( now ); calendar.setTimeZone( timeZone ); if ( offset != 0 && unit != null ) { unit = unit.toLowerCase(); if ( unit.indexOf( "millisecond" ) == 0 ) { calendar.add( Calendar.MILLISECOND, offset ); } else if ( unit.indexOf( "second" ) == 0 ) { calendar.add( Calendar.SECOND, offset ); } else if ( unit.indexOf( "minute" ) == 0 ) { calendar.add( Calendar.MINUTE, offset ); } else if ( unit.indexOf( "hour" ) == 0 ) { calendar.add( Calendar.HOUR, offset ); } else if ( unit.indexOf( "day" ) == 0 ) { calendar.add( Calendar.DAY_OF_MONTH, offset ); } else if ( unit.indexOf( "week" ) == 0 ) { calendar.add( Calendar.WEEK_OF_YEAR, offset ); } else if ( unit.indexOf( "month" ) == 0 ) { calendar.add( Calendar.MONTH, offset ); } else if ( unit.indexOf( "year" ) == 0 ) { calendar.add( Calendar.YEAR, offset ); } } format.setTimeZone( timeZone ); defineProperty( name, format.format( calendar.getTime() ) ); } } build-helper-maven-plugin-1.8/src/main/java/org/codehaus/mojo/buildhelper/MavenVersionMojo.java0000664000175000017500000000444612027557655032303 0ustar ebourgebourgpackage 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.execution.RuntimeInformation; 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; /** * Store the maven core version in a property maven.version. * * @author pgier * @since 1.3 */ @Mojo( name = "maven-version", defaultPhase = LifecyclePhase.VALIDATE, threadSafe = true ) public class MavenVersionMojo extends AbstractDefinePropertyMojo { /** * The RuntimeInforamtion for the current instance of Maven. */ @Component private RuntimeInformation runtime; /** * The name of the property in which to store the version of Maven. */ @Parameter( defaultValue = "maven.version" ) private String versionProperty; /** * Main plugin execution * */ public void execute() { ArtifactVersion mavenVersion = runtime.getApplicationVersion(); defineProperty( versionProperty, mavenVersion.toString() ); } }././@LongLink0000644000000000000000000000015212234547251011645 Lustar rootrootbuild-helper-maven-plugin-1.8/src/main/java/org/codehaus/mojo/buildhelper/AbstractDefinePropertyMojo.javabuild-helper-maven-plugin-1.8/src/main/java/org/codehaus/mojo/buildhelper/AbstractDefinePropertyMojo0000664000175000017500000000372312027712425033353 0ustar ebourgebourgpackage 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.AbstractMojo; import org.apache.maven.plugins.annotations.Component; import org.apache.maven.project.MavenProject; public abstract class AbstractDefinePropertyMojo extends AbstractMojo { /** * The maven project */ @Component private MavenProject project; protected void defineProperty( String name, String value ) { if ( getLog().isDebugEnabled() ) { getLog().debug( "define property " + name + " = \"" + value + "\"" ); } project.getProperties().put( name, value ); } /** * Get the current project instance. * * @return the project */ public MavenProject getProject() { return this.project; } } build-helper-maven-plugin-1.8/src/main/java/org/codehaus/mojo/buildhelper/ReleasedVersionMojo.java0000664000175000017500000001250012027557655032747 0ustar ebourgebourgpackage 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.artifact.ArtifactUtils; import org.apache.maven.artifact.factory.ArtifactFactory; import org.apache.maven.artifact.metadata.ArtifactMetadataRetrievalException; import org.apache.maven.artifact.metadata.ArtifactMetadataSource; import org.apache.maven.artifact.repository.ArtifactRepository; import org.apache.maven.artifact.versioning.ArtifactVersion; 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; /** * Resolve the latest released version of this project. * This mojo sets the following properties: * *
 *   [propertyPrefix].version
 *   [propertyPrefix].majorVersion
 *   [propertyPrefix].minorVersion
 *   [propertyPrefix].incrementalVersion   
 * 
* * Where the propertyPrefix is the string set in the mojo parameter. * * @author Robert Scholte * @since 1.6 */ @Mojo( name = "released-version", defaultPhase = LifecyclePhase.VALIDATE, threadSafe = true ) public class ReleasedVersionMojo extends AbstractDefinePropertyMojo { /** * The artifact metadata source to use. */ @Component private ArtifactMetadataSource artifactMetadataSource; @Component private ArtifactFactory artifactFactory; @Parameter( defaultValue = "${localRepository}", readonly = true ) private ArtifactRepository localRepository; @Parameter( defaultValue = "${project.remoteArtifactRepositories}", readonly = true ) private List remoteArtifactRepositories; /** * Prefix string to use for the set of version properties. */ @Parameter( defaultValue = "releasedVersion" ) private String propertyPrefix; private void defineVersionProperty( String name, String value ) { defineProperty( propertyPrefix + '.' + name, value ); } private void defineVersionProperty( String name, int value ) { defineVersionProperty( name, Integer.toString( value ) ); } @SuppressWarnings( "unchecked" ) public void execute() { org.apache.maven.artifact.Artifact artifact = artifactFactory.createArtifact( getProject().getGroupId(), getProject().getArtifactId(), "", "", "" ); try { ArtifactVersion releasedVersion = null; List versions = artifactMetadataSource.retrieveAvailableVersions( artifact, localRepository, remoteArtifactRepositories ); for ( ArtifactVersion version : versions ) { if ( !ArtifactUtils.isSnapshot( version.toString() ) && ( releasedVersion == null || version.compareTo( releasedVersion ) == 1 ) ) { releasedVersion = version; } } if ( releasedVersion != null ) { // Use ArtifactVersion.toString(), the major, minor and incrementalVersion return all an int. String releasedVersionValue = releasedVersion.toString(); // This would not always reflect the expected version. int dashIndex = releasedVersionValue.indexOf( '-' ); if ( dashIndex >= 0 ) { releasedVersionValue = releasedVersionValue.substring( 0, dashIndex ); } defineVersionProperty( "version", releasedVersionValue ); defineVersionProperty( "majorVersion", releasedVersion.getMajorVersion() ); defineVersionProperty( "minorVersion", releasedVersion.getMinorVersion() ); defineVersionProperty( "incrementalVersion", releasedVersion.getIncrementalVersion() ); } } catch ( ArtifactMetadataRetrievalException e ) { if ( getLog().isWarnEnabled() ) { getLog().warn( "Failed to retrieve artifacts metadata, cannot resolve the released version" ); } } } } ././@LongLink0000644000000000000000000000014712234547251011651 Lustar rootrootbuild-helper-maven-plugin-1.8/src/main/java/org/codehaus/mojo/buildhelper/RemoveLocalArtifactMojo.javabuild-helper-maven-plugin-1.8/src/main/java/org/codehaus/mojo/buildhelper/RemoveLocalArtifactMojo.ja0000664000175000017500000000763212027421275033212 0ustar ebourgebourgpackage 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 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; import org.apache.maven.project.MavenProject; 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. * * @author Dan T. Tran * @version $Id: RemoveLocalArtifactMojo.java 17587 2012-09-22 20:42:37Z hboutemy $ * @since 1.1 */ @Mojo( name = "remove-project-artifact", defaultPhase = LifecyclePhase.PACKAGE, threadSafe = true ) public class RemoveLocalArtifactMojo extends AbstractMojo { /** * When true, remove all built artifacts including all versions. * When false, remove all built artifacts of this project version. * * @since 1.1 */ @Parameter( defaultValue = "true", property = "buildhelper.removeAll" ) private boolean removeAll; /** * Indicates whether the build will continue even if there are removal errors. * * @since 1.6 */ @Parameter( defaultValue = "true", property = "buildhelper.failOnError" ) private boolean failOnError; /** * @since 1.1 */ @Component private MavenProject project; /** * @since 1.1 */ @Parameter( defaultValue = "${localRepository}", readonly = true ) private ArtifactRepository localRepository; public void execute() throws MojoFailureException { File localArtifactFile = new File( localRepository.getBasedir(), localRepository.pathOf( project.getArtifact() ) ); File localArtifactDirectory = localArtifactFile.getParentFile(); if ( removeAll ) { localArtifactDirectory = localArtifactDirectory.getParentFile(); } try { FileUtils.deleteDirectory( localArtifactDirectory ); if ( getLog().isInfoEnabled() ) { getLog().info( localArtifactDirectory.getAbsolutePath() + " removed." ); } } catch ( IOException e ) { final String failureMessage = "Cannot delete " + localArtifactDirectory; if ( failOnError ) { throw new MojoFailureException( failureMessage ); } else { getLog().warn( failureMessage ); } } } } build-helper-maven-plugin-1.8/src/main/java/org/codehaus/mojo/buildhelper/AttachArtifactMojo.java0000664000175000017500000001340412027421275032527 0ustar ebourgebourgpackage 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.execution.MavenSession; import org.apache.maven.plugin.AbstractMojo; import org.apache.maven.plugin.MojoExecutionException; import org.apache.maven.plugin.MojoFailureException; import org.apache.maven.plugins.annotations.Component; import org.apache.maven.plugins.annotations.LifecyclePhase; import org.apache.maven.plugins.annotations.Mojo; import org.apache.maven.plugins.annotations.Parameter; 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 $ * @since 1.0 */ @Mojo( name = "attach-artifact", defaultPhase = LifecyclePhase.PACKAGE, threadSafe = true ) public class AttachArtifactMojo extends AbstractMojo { /** * Attach an array of artifacts to the project. */ @Parameter( required = true ) private Artifact [] artifacts; /** * This project's base directory. * * @since 1.5 */ @Parameter( defaultValue = "${basedir}" ) private String basedir; /** * The Maven Session. * * @since 1.5 */ @Component private MavenSession mavenSession; @Component private MavenProject project; /** * Maven ProjectHelper. */ @Component 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. * * @since 1.5 */ @Parameter( property = "buildhelper.runOnlyAtExecutionRoot", defaultValue = "false" ) 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. * * @since 1.6 */ @Parameter( property = "buildhelper.skipAttach", defaultValue = "false" ) private boolean skipAttach; public void execute() throws MojoExecutionException, MojoFailureException { if ( skipAttach ) { getLog().info( "Skip attaching artifacts" ); return; } // Run only at the execution root if ( runOnlyAtExecutionRoot && !isThisTheExecutionRoot() ) { getLog().info( "Skip attaching artifacts in this project because it's not the Execution Root" ); } else { this.validateArtifacts(); for ( Artifact artifact : artifacts ) { 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 { // check unique of types and classifiers Set extensionClassifiers = new HashSet(); for ( Artifact artifact : artifacts ) { String extensionClassifier = artifact.getType() + ":" + artifact.getClassifier(); if ( !extensionClassifiers.add( extensionClassifier ) ) { throw new MojoFailureException( "The artifact with same type and classifier: " + extensionClassifier + " is used more than once." ); } } } } build-helper-maven-plugin-1.8/src/main/java/org/codehaus/mojo/buildhelper/LocalIpMojo.java0000664000175000017500000000451412027557655031206 0ustar ebourgebourgpackage 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.net.InetAddress; import java.net.UnknownHostException; 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 current host IP address and place it under a configurable project property * * @author Dan T. Tran * @since 1.8 */ @Mojo( name = "local-ip", defaultPhase = LifecyclePhase.PROCESS_TEST_CLASSES, threadSafe = true ) public class LocalIpMojo extends AbstractDefinePropertyMojo { /** * The name of the property in which to store the version of maven. */ @Parameter( defaultValue = "local.ip" ) private String localIpProperty; public void execute() throws MojoExecutionException { try { defineProperty( this.localIpProperty, InetAddress.getLocalHost().getHostAddress() ); } catch ( UnknownHostException e ) { throw new MojoExecutionException( "Unable to retrieve localhost address.", e ); } } } ././@LongLink0000644000000000000000000000014712234547251011651 Lustar rootrootbuild-helper-maven-plugin-1.8/src/main/java/org/codehaus/mojo/buildhelper/ReserveListenerPortMojo.javabuild-helper-maven-plugin-1.8/src/main/java/org/codehaus/mojo/buildhelper/ReserveListenerPortMojo.ja0000664000175000017500000002077412124603552033312 0ustar ebourgebourgpackage 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.FileOutputStream; import java.io.IOException; import java.io.OutputStream; import java.net.ServerSocket; import java.util.ArrayList; 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; import org.apache.maven.project.MavenProject; import org.codehaus.plexus.util.IOUtil; /** * 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 */ @Mojo( name = "reserve-network-port", defaultPhase = LifecyclePhase.PROCESS_TEST_CLASSES, threadSafe = true ) public class ReserveListenerPortMojo extends AbstractMojo { private static final String BUILD_HELPER_RESERVED_PORTS = "BUILD_HELPER_MIN_PORT"; private static final Integer FIRST_NON_ROOT_PORT_NUMBER = 1024; private static final Integer MAX_PORT_NUMBER = 65536; /** * A List to property names to be placed in Maven project * * @since 1.2 */ @Parameter( required = true ) private String[] portNames = new String[0]; /** * Output file to write the generated properties to. if not given, they are written to Maven project * * @since 1.2 */ @Parameter private File outputFile; /** * Specify this if you want the port be chosen with a number higher than that one. *

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

* * @since 1.8 */ @Parameter private Integer minPortNumber; /** * Specify this if you want the port be chosen with a number lower than that one. * * @since 1.8 */ @Parameter private Integer maxPortNumber; /** * @since 1.2 */ @Component private MavenProject project; public void execute() throws MojoExecutionException { Properties properties = project.getProperties(); if ( outputFile != null ) { properties = new Properties(); } // Reserve the entire block of ports to guarantee we don't get the same port twice final List sockets = new ArrayList(); try { for ( String portName : portNames ) { try { final ServerSocket socket = getServerSocket(); sockets.add( socket ); final String unusedPort = Integer.toString( socket.getLocalPort() ); properties.put( portName, unusedPort ); getReservedPorts().add( socket.getLocalPort() ); this.getLog().info( "Reserved port " + unusedPort + " for " + portName ); } catch ( IOException e ) { throw new MojoExecutionException( "Error getting an available port from system", e ); } } // Write the file -- still hold onto the ports if ( outputFile != null ) { OutputStream os = null; try { os = new FileOutputStream( outputFile ); properties.store( os, null ); } catch ( Exception e ) { throw new MojoExecutionException( e.getMessage() ); } finally { IOUtil.close( os ); } } } finally { // Now free all the ports for ( ServerSocket socket : sockets ) { final int localPort = socket.getLocalPort(); try { socket.close(); } catch ( IOException e ) { this.getLog().error( "Cannot free reserved port " + localPort ); } } } } private ServerSocket getServerSocket() throws IOException, MojoExecutionException { if ( minPortNumber == null && maxPortNumber != null ) { getLog().debug( "minPortNumber unspecified: using default value " + FIRST_NON_ROOT_PORT_NUMBER ); minPortNumber = FIRST_NON_ROOT_PORT_NUMBER; } if ( minPortNumber != null && maxPortNumber == null ) { getLog().debug( "maxPortNumber unspecified: using default value " + MAX_PORT_NUMBER ); maxPortNumber = MAX_PORT_NUMBER; } if ( minPortNumber == null && maxPortNumber == null ) { return new ServerSocket( 0 ); } else { int min = getNextPortNumber(); for ( int port = min;; ++port ) { if ( port > maxPortNumber ) { throw new MojoExecutionException( "Unable to find an available port between " + minPortNumber + " and " + maxPortNumber ); } try { ServerSocket serverSocket = new ServerSocket( port ); return serverSocket; } catch ( IOException ioe ) { getLog().debug( "Tried binding to port " + port + " without success. Trying next port.", ioe ); } } } } private int getNextPortNumber() { assert minPortNumber != null; List reservedPorts = getReservedPorts(); int nextPort = -1; if ( reservedPorts.isEmpty() ) { nextPort = minPortNumber; } else { nextPort = findAvailablePortNumber( minPortNumber, reservedPorts ); } reservedPorts.add( nextPort ); getLog().debug( "Next port: " + nextPort ); return nextPort; } private List getReservedPorts() { List reservedPorts = (List) getPluginContext().get( BUILD_HELPER_RESERVED_PORTS ); if ( reservedPorts == null ) { reservedPorts = new ArrayList(); getPluginContext().put( BUILD_HELPER_RESERVED_PORTS, reservedPorts ); } return reservedPorts; } /** * 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. */ private int findAvailablePortNumber( Integer portNumberStartingPoint, List reservedPorts ) { assert portNumberStartingPoint != null; int candidate = portNumberStartingPoint; while ( reservedPorts.contains( candidate ) ) { candidate++; } return candidate; } } build-helper-maven-plugin-1.8/src/main/java/org/codehaus/mojo/buildhelper/ParseVersionMojo.java0000664000175000017500000001421012027557655032275 0ustar ebourgebourgpackage 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; /** * Parse a version string and set properties containing the component parts of the version. This mojo sets the * following properties: * *
 *   [propertyPrefix].majorVersion
 *   [propertyPrefix].minorVersion
 *   [propertyPrefix].incrementalVersion
 *   [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: *
 *   [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 * * @author pgier * @version $Id: ParseVersionMojo.java 17589 2012-09-23 10:08:45Z hboutemy $ * @since 1.3 */ @Mojo( name = "parse-version", defaultPhase = LifecyclePhase.VALIDATE, threadSafe = true ) public class ParseVersionMojo extends AbstractDefinePropertyMojo { /** * The version string to parse. */ @Parameter( defaultValue = "${project.version}" ) private String versionString; /** * Prefix string to use for the set of version properties. */ @Parameter( defaultValue = "parsedVersion" ) private String propertyPrefix; /** * Execute the mojo. This sets the version properties on the project. * * @throws MojoExecutionException if the plugin execution fails. */ public void execute() { parseVersion( versionString ); } private void defineVersionProperty( String name, String value ) { defineProperty( propertyPrefix + '.' + name, value ); } private void defineVersionProperty( String name, int value ) { defineVersionProperty( name, Integer.toString( value ) ); } /** * Parse a version String and add the components to a properties object. * * @param version the version to parse */ public void parseVersion( String version ) { ArtifactVersion artifactVersion = new DefaultArtifactVersion( 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 ); } 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 ); String qualifier = artifactVersion.getQualifier(); if ( qualifier == null ) { qualifier = ""; } defineVersionProperty( "qualifier", qualifier ); defineVersionProperty( "buildNumber", artifactVersion.getBuildNumber() ); // Replace the first instance of "-" to create an osgi compatible version string. String osgiVersion = getOsgiVersion( artifactVersion ); defineVersionProperty( "osgiVersion", osgiVersion ); } public void setPropertyPrefix( String prefix ) { this.propertyPrefix = prefix; } /** * Make an osgi compatible version String from an ArtifactVersion * @param version * @return */ public String getOsgiVersion( ArtifactVersion version ) { if ( version.toString().equals( version.getQualifier() ) ) { return version.toString(); } StringBuffer osgiVersion = new StringBuffer(); osgiVersion.append( version.getMajorVersion() ); osgiVersion.append( "." + version.getMinorVersion() ); osgiVersion.append( "." + version.getIncrementalVersion() ); if ( version.getQualifier() != null || version.getBuildNumber() != 0 ) { osgiVersion.append( "." ); if ( version.getQualifier() != null ) { osgiVersion.append( version.getQualifier() ); } if ( version.getBuildNumber() != 0 ) { osgiVersion.append( version.getBuildNumber() ); } } return osgiVersion.toString(); } } build-helper-maven-plugin-1.8/src/main/java/org/codehaus/mojo/buildhelper/OsgiArtifactVersion.java0000664000175000017500000001716211600210726032743 0ustar ebourgebourgpackage 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(); } } ././@LongLink0000644000000000000000000000014712234547251011651 Lustar rootrootbuild-helper-maven-plugin-1.8/src/main/java/org/codehaus/mojo/buildhelper/AbstractAddResourceMojo.javabuild-helper-maven-plugin-1.8/src/main/java/org/codehaus/mojo/buildhelper/AbstractAddResourceMojo.ja0000664000175000017500000000537112064552344033211 0ustar ebourgebourgpackage 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 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 */ public abstract class AbstractAddResourceMojo extends AbstractMojo { /** * Additional resource directories. */ @Parameter( required = true ) private Resource[] resources; /** * The maven project */ @Component private MavenProject project; /** * Main plugin execution */ public void execute() { for ( Resource resource : resources ) { // Check for relative paths in the resource configuration. // http://maven.apache.org/plugin-developers/common-bugs.html#Resolving_Relative_Paths File resourceDir = new File( resource.getDirectory() ); if ( !resourceDir.isAbsolute() ) { 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. * * @return the project */ public MavenProject getProject() { return this.project; } } build-helper-maven-plugin-1.8/src/main/java/org/codehaus/mojo/buildhelper/AddResourceMojo.java0000664000175000017500000000360712027417451032052 0ustar ebourgebourgpackage 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.model.Resource; import org.apache.maven.plugins.annotations.LifecyclePhase; import org.apache.maven.plugins.annotations.Mojo; /** * Add more resource directories to the POM. * * @author Paul Gier * @version $Id: AddResourceMojo.java 17586 2012-09-22 20:27:21Z hboutemy $ * @since 1.3 */ @Mojo( name = "add-resource", defaultPhase = LifecyclePhase.GENERATE_RESOURCES, threadSafe = true ) public class AddResourceMojo extends AbstractAddResourceMojo { public void addResource( Resource resource ) { getProject().addResource( resource ); if ( getLog().isDebugEnabled() ) { getLog().debug( "Added resource: " + resource.getDirectory() ); } } } build-helper-maven-plugin-1.8/src/main/java/org/codehaus/mojo/buildhelper/AddSourceMojo.java0000664000175000017500000000457612027417451031531 0ustar ebourgebourgpackage 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 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; import org.apache.maven.project.MavenProject; /** * Add more source directories to the POM. * * @author Dan T. Tran * @version $Id: AddSourceMojo.java 17586 2012-09-22 20:27:21Z hboutemy $ * @since 1.0 */ @Mojo( name = "add-source", defaultPhase = LifecyclePhase.GENERATE_SOURCES, threadSafe = true ) public class AddSourceMojo extends AbstractMojo { /** * Additional source directories. * * @since 1.0 */ @Parameter( required = true ) private File[] sources; /** * @since 1.0 */ @Component private MavenProject project; public void execute() { for ( File source : sources ) { this.project.addCompileSourceRoot( source.getAbsolutePath() ); if( getLog().isInfoEnabled() ) { getLog().info( "Source directory: " + source + " added." ); } } } } build-helper-maven-plugin-1.8/src/main/java/org/codehaus/mojo/buildhelper/Artifact.java0000664000175000017500000000527711600210726030557 0ustar ebourgebourgpackage 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; /** *

Artifact class.

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

Setter for the field file.

* * @param localFile a {@link java.io.File} object. */ public void setFile( File localFile ) { this.file = localFile; } /** *

Getter for the field file.

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

Setter for the field type.

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

Getter for the field type.

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

Setter for the field classifier.

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

Getter for the field classifier.

* * @return a {@link java.lang.String} object. */ public String getClassifier () { return this.classifier; } } build-helper-maven-plugin-1.8/src/main/java/org/codehaus/mojo/buildhelper/AddTestSourceMojo.java0000664000175000017500000000463712027417451032367 0ustar ebourgebourgpackage 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 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; import org.apache.maven.project.MavenProject; /** * Add test source directories to the POM. * * @author Dan T. Tran * @version $Id: AddTestSourceMojo.java 17586 2012-09-22 20:27:21Z hboutemy $ * @since 1.0 */ @Mojo( name = "add-test-source", defaultPhase = LifecyclePhase.GENERATE_TEST_SOURCES, threadSafe = true ) public class AddTestSourceMojo extends AbstractMojo { /** * Additional test source directories. * * @since 1.0 */ @Parameter( required = true ) private File[] sources; /** * @since 1.0 */ @Component 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." ); } } } } build-helper-maven-plugin-1.8/src/main/java/org/codehaus/mojo/buildhelper/BeanshellPropertyMojo.java0000664000175000017500000001077512027714326033321 0ustar ebourgebourgpackage 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.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; import org.apache.maven.settings.Settings; import bsh.EvalError; import bsh.Interpreter; /** * 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.
  • *
* * @author Hervé Boutemy * @since 1.8 */ @Mojo( name = "bsh-property", defaultPhase = LifecyclePhase.VALIDATE, threadSafe = true ) public class BeanshellPropertyMojo extends AbstractDefinePropertyMojo { @Parameter( required = true ) 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. */ @Parameter private String[] properties; /** * The Maven Session. */ @Component private MavenSession mavenSession; /** * The Maven Settings. */ @Component private Settings settings; /** * Main plugin execution */ public void execute() throws MojoFailureException { Interpreter interpreter = new Interpreter(); set( interpreter, "project", getProject() ); set( interpreter, "session", mavenSession ); set( interpreter, "settings", settings ); try { interpreter.eval( source ); } catch ( EvalError ee ) { MojoFailureException mfe = new MojoFailureException( "error during Beanshell script execution: " + ee.getMessage() ); mfe.initCause( ee ); throw mfe; } if ( properties != null ) { for ( String property : properties ) { Object value; try { value = interpreter.get( property ); if ( value != null ) { defineProperty( property, value.toString() ); } } catch ( EvalError ee ) { MojoFailureException mfe = new MojoFailureException( "cannot get Beanshell global variable '" + property + "': " + ee.getMessage() ); mfe.initCause( ee ); throw mfe; } } } } private void set( Interpreter interpreter, String name, Object value ) throws MojoFailureException { try { interpreter.set( name, value ); } catch ( EvalError ee ) { MojoFailureException mfe = new MojoFailureException( "cannot define Beanshell global variable '" + name + "': " + ee.getMessage() ); mfe.initCause( ee ); throw mfe; } } } build-helper-maven-plugin-1.8/header.txt0000664000175000017500000000245010773161441017666 0ustar ebourgebourg^package ^\s*$ ^/\*\s*$ ^ \* The MIT License\s*$ ^ \*\s*$ ^ \* Copyright \(c\) \d{4}(-\d{4}){0,1}, The Codehaus\s*$ ^ \*\s*$ ^ \* Permission is hereby granted, free of charge, to any person obtaining a copy of\s*$ ^ \* this software and associated documentation files \(the "Software"\), to deal in\s*$ ^ \* the Software without restriction, including without limitation the rights to\s*$ ^ \* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies\s*$ ^ \* of the Software, and to permit persons to whom the Software is furnished to do\s*$ ^ \* so, subject to the following conditions:\s*$ ^ \*\s*$ ^ \* The above copyright notice and this permission notice shall be included in all\s*$ ^ \* copies or substantial portions of the Software\.\s*$ ^ \*\s*$ ^ \* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\s*$ ^ \* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\s*$ ^ \* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\s*$ ^ \* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\s*$ ^ \* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\s*$ ^ \* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\s*$ ^ \* SOFTWARE\.\s*$ ^ \*/\s*$ ^\s*$ build-helper-maven-plugin-1.8/pom.xml0000664000175000017500000001502312124651207017206 0ustar ebourgebourg 4.0.0 org.codehaus.mojo mojo-parent 30 build-helper-maven-plugin 1.8 maven-plugin Build Helper Maven Plugin This plugin contains various small independent goals to assist with Maven build lifecycle 2005 The MIT License http://www.opensource.org/licenses/mit-license.php repo Dan Tran dantran@gmail.com Developer 5 rfscholte Robert Scholte 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 JIRA http://jira.codehaus.org/browse/MBUILDHELPER 2.0.6 1.5 org.apache.maven maven-model ${mavenVersion} org.apache.maven maven-project ${mavenVersion} org.apache.maven maven-core ${mavenVersion} org.apache.maven maven-plugin-api ${mavenVersion} org.apache.maven maven-artifact ${mavenVersion} org.apache.maven.plugin-tools maven-plugin-annotations 3.1 provided org.codehaus.plexus plexus-utils 1.5.8 org.beanshell bsh 2.0b4 org.apache.maven.plugins maven-plugin-plugin 3.1 org.apache.maven.plugins maven-plugin-plugin true mojo-descriptor descriptor org.apache.maven.plugins maven-checkstyle-plugin config/maven_checks.xml 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 run-its skipTests !true org.apache.maven.plugins maven-invoker-plugin true verify ${project.build.directory}/local-repo src/it/settings.xml ${project.build.directory}/it integration-test install run