I am experimenting the Jenkins, and am looking for a way to allow Jenkins to set parameters for different project builds. Normally all these attributes are stored in the set
There are some options for you. Here's what I'm using:
findbugs-exclude.xml
org.codehaus.mojo
findbugs-maven-plugin
findbugs-exclude.xml
package
org.apache.maven.plugins
maven-dependency-plugin
copy-dependencies
package
copy-dependencies
${project.build.directory}/lib
false
false
true
runtime
The you can define in jenkins clean install -P package
- for package task or clean install
for normal build
Maven call:
mvn clean install -Dparameter.one=ONE -Dparameter.two=TWO
POM:
4.0.0
com.test
test
1.0.0
test
6.4
org.testng
testng
${testng.version}
test
If you run it normally testng version 6.4 will be used. But if you run it like:
mvn clean install -Dtestng.version=6.3.1
testng version 6.3.1 will be used.
See
Downloading: http://repo.maven.apache.org/maven2/org/testng/testng/6.3.1/testng-6.3.1.pom Downloaded: http://repo.maven.apache.org/maven2/org/testng/testng/6.3.1/testng-6.3.1.pom (0 B at 0.0 KB/sec) Downloading: http://repo.maven.apache.org/maven2/org/testng/testng/6.3.1/testng-6.3.1.jar Downloaded: http://repo.maven.apache.org/maven2/org/testng/testng/6.3.1/testng-6.3.1.jar (0 B at 0.0 KB/sec)
You can parametrize default part of pom (setting default values directly and overriding it by execution properties)
Change in last example version:
org.testng
testng
${env.testngVersion}
test
In bash you can call:
export testngVersion=6.0
mvn clean install
Or in jenkins by setting testngVersion=6.0 in This build is parameterized
section