Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Testing versions of dependencies in maven

To make the modules less dependent of specific versions, I would like to test the modules with different versions of the dependencies so I can determine the 'corners' of the version box the module will work happily in.

e.g. the module is built in against library foo.bar 2.1.2. Then the tool should test 2.0.0 and if it fails the versions in between like git bisect. Then similar between 2.1.2 and whatever the latest version is. Then do that with the next dependency.

I found that it is often rather trivial to extend the range of versions by tweaking how the library is being used. When deploying to an OSGi container, running in a wide set of versions per dependency makes life a lot less painful. However manually testing so many combinations is an absolute nightmare.

Does anybody know of such a tool so it can run on a CI server at night?

PS: I know such a tool would have all kinds of gnarly edge case and imperfections. I just want to reduce the amount of assumptions that are implicitely being made when building modules. Normal testing will catch these weird cases anyway.

like image 483
Peter Tillemans Avatar asked Nov 01 '22 06:11

Peter Tillemans


1 Answers

Use Jenkins Matrix Project Plugin - see https://wiki.jenkins-ci.org/display/JENKINS/Building+a+matrix+project

In your pom.xml define the version as a property.

<properties>
  <my.version>1.30</my.version>
</properties>
...
<dependency>
  <groupId>com.acme</groupId>
  <artifactId>my-artifact</artifactId>
  <version>${my.version}</version>
</dependency>

Then provide a test version with each iteration of the Jenkins Matrix.

mvn test -Dmy.version=1.31
like image 182
Andre Avatar answered Nov 03 '22 00:11

Andre