There are several options for you. Here is what I use:
Create profiles in your assembly.
<profile> <activation> <file> <exists>findbugs-exclude.xml</exists> </file> </activation> <build> <plugins> <plugin> <groupId>org.codehaus.mojo</groupId> <artifactId>findbugs-maven-plugin</artifactId> <configuration> <excludeFilterFile>findbugs-exclude.xml</excludeFilterFile> </configuration> </plugin> </plugins> </build> </profile> <profile> <id>package</id> <build> <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-dependency-plugin</artifactId> <executions> <execution> <id>copy-dependencies</id> <phase>package</phase> <goals> <goal>copy-dependencies</goal> </goals> <configuration> <outputDirectory>${project.build.directory}/lib</outputDirectory> <overWriteReleases>false</overWriteReleases> <overWriteSnapshots>false</overWriteSnapshots> <overWriteIfNewer>true</overWriteIfNewer> <includeScope>runtime</includeScope> </configuration> </execution> </executions> </plugin> </plugins> </build> </profile>
You can define in jenkins clean install -P package - for the package task or clean install for normal build
Put the parameters directly in pom from the command line:
Call Maven:
mvn clean install -Dparameter.one=ONE -Dparameter.two=TWO
POM:
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> <modelVersion>4.0.0</modelVersion> <groupId>com.test</groupId> <artifactId>test</artifactId> <version>1.0.0</version> <name>test</name> <properties> <testng.version>6.4</testng.version> </properties> <dependencies> <dependency> <groupId>org.testng</groupId> <artifactId>testng</artifactId> <version>${testng.version}</version> <scope>test</scope> </dependency> </dependencies> </project>
If you run it, then 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.
Cm
Download: 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) Download: 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 parameterize the standard pom part (directly set default values ββand override them using runtime properties)
Edit in the latest sample version:
<dependency> <groupId>org.testng</groupId> <artifactId>testng</artifactId> <version>${env.testngVersion}</version> <scope>test</scope> </dependency>
In bash, you can call:
export testngVersion=6.0 mvn clean install
Or in jenkins by setting testngVersion = 6.0 in the This build is parameterized section
Andrzej Jozwik Feb 28 '12 at 8:30 2012-02-28 08:30
source share