I have two projects, project A is depending on project B, so normally, I'd have the following section in my projectA/pom.xml:
<dependency>
<artifactId>projectB</artifactId>
<groupId>blabla</groupId>
<version>version1</version>
</dependency>
What I am trying to achieve is very straight forward, does maven profile allow me to do anything like:
if(profileA) {
<version>version1</version>
}
else {
<version>version2</version>
}
Yes, this can be done (put activeByDefault
to whichever profile you need to be default).
<dependency>
<artifactId>projectB</artifactId>
<groupId>blabla</groupId>
<version>${dependency.version}</version>
</dependency>
...
<profiles>
<profile>
<id>first</id>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
<properties>
<dependency.version>1.2.3</dependency.version>
</properties>
</profile>
<profile>
<id>second</id>
<properties>
<dependency.version>2.3.4</dependency.version>
</properties>
</profile>
</profiles>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With