Reputation: 11113
Is there a way with Maven to build and test a project multiple times across a range of dependency versions?
For instance, Say I have the following Libraries:
groupId artifactId version
com.example library 1.0
com.example library 1.1
com.example library 2.0
com.example library 2.2
And my build produces a jar artifact: output.jar
Could I produce the following against each of the library versions:
groupId artifactId version result
com.example library 1.0 output_1.0.jar
com.example library 1.1 output_1.1.jar
com.example library 2.0 output_2.0.jar
com.example library 2.2 output_2.2.jar
Upvotes: 0
Views: 369
Reputation: 13556
You could use the matrix project feature of jenkins or hudson. See https://wiki.jenkins-ci.org/display/JENKINS/Building+a+matrix+project
A multi-configuration project is useful for instances where your builds will make many similar build steps, and you would otherwise be duplicating steps.
But you can't build the project on you local machine that way.
Upvotes: 1
Reputation: 11815
try profiles http://maven.apache.org/guides/introduction/introduction-to-profiles.html
<profiles>
<profile>
<id>version1.0</id>
<dependencies>
<dependency>
<groupId>com.example</groupId>
<artifactId>library</artifactId>
<version>1.0</version>
</dependency>
</dependencies>
<build>
<finalName>${project.artifactId}-library-1.0.jar</finalName>
</build>
</profile>
<profile>
<id>version1.1</id>
<dependencies>
<dependency>
<groupId>com.example</groupId>
<artifactId>library</artifactId>
<version>1.1</version>
</dependency>
</dependencies>
<build>
<finalName>${project.artifactId}-library-1.1.jar</finalName>
</build>
</profile>
</profiles>
Then when you call maven,: mvn -Pversion1.1
One of your profiles should probably be active by default so that you can compile without having a specific profile enabled.
<activation>
<activeByDefault>true</activeByDefault>
</activation>
Upvotes: 2