I have a java project with mvn I need to have different version based on the mvn profile
<GroupId>com.company.com</GroupId>
<ArtifactId>xxx<ArtifactId/>
<Version>{version.profile}</version>
How do I set version.profile based on the profile?
you can create profiles like below
<profiles>
<profile>
<id>demo1</id>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
<properties>
<demolib.version>1.0.0</demolib.version>
</properties>
</profile>
<profile>
<id>demo2</id>
<properties>
<demolib.version>2.0.0</demolib.version>
</properties>
</profile>
</profiles>
then your default profile is demo1, and version is 1.0.0 you can use variables in profile in your maven
<GroupId>com.company.com</GroupId>
<ArtifactId>xxx<ArtifactId/>
<Version>{demolib.version}</version>
if you want to build with version 2.0.0 just run maven with mvn -Pdemo2 package
also you can use multiple parameter like mvn -Pdemo2,example2 package
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.