Reputation: 421
I have created one maven project(Desktop application). Now I would like to make the same project, but I want to change some of the dependency versions.
For example I have lib-1.0.jar and lib-2.0.jar. Now I would like to debug one of my projects with lib-1.0.jar and another project with lib-2.0.jar.
What is the best approach to achieve this? I dont want to edit my pom by hand everytime I debug the project.
Upvotes: 0
Views: 43
Reputation: 61148
Set a property for the version number, something like:
<properties>
<lib.version>1.0</lib.version>
</properties>
And use that in the dependency:
<dependency>
<groupId>lib.group</groupId>
<artifactId>lib</artifactId>
<version>${lib.version}</version>
</dependency>
Now you can simply override this in a profile:
<profile>
<id>bleeding-edge</id>
<properties>
<lib.version>2.0</lib.version>
</properties>
</profile>
And run with the profile to use the different version:
mvn -P bleeding-edge clean install
Note that this will probably confuse your IDE no end - with some IDE's you can set the profiles used.
Upvotes: 4