我需要一次构建Snapshot版本和Release版本。
要构建快照版本,我确实喜欢这个
<groupId>com.abc.xyz</groupId>
<artifactId>service</artifactId>
<version>1.0.3-SNAPSHOT</version>
<distributionManagement>
<snapshotRepository>
<id>mvn-git-repo</id>
<uniqueVersion>true</uniqueVersion>
<name>maven git repository</name>
<url>file:/home/mvn-github-repo/snapshot</url>
</snapshotRepository>
</distributionManagement>
要构建发布版本,
<groupId>com.abc.xyz</groupId>
<artifactId>service</artifactId>
<version>1.0.3</version>
<distributionManagement>
<repository>
<id>mvn-git-repo</id>
<uniqueVersion>true</uniqueVersion>
<name>maven git repository</name>
<url>file:/home/mvn-github-repo/release</url>
</repository>
</distributionManagement>
是否可以将它们组合在一起,以便它应该生成快照版本,并且同时发布版本jar并在各自的存储库中部署。如果可能,我应该保留在pom中的版本是什么?
答案 0 :(得分:0)
您使用个人资料来定义版本和回购,就像这个
一样<version>${buildVersion}</version>
.
.
.
<profiles>
<profile>
<id>snapshot-repo</id>
<activation>
<property>
<name>snapshot</name>
<value>true</value>
</property>
</activation>
<properties>
<buildVersion>1.0.3-SNAPSHOT</buildVersion>
</properties>
<distributionManagement>
<repository>
</repository>
<snapshotRepository>
</snapshotRepository>
</distributionManagement>
</profile>
<profile>
<id>git-repo</id>
<activation>
<property>
<name>!snapshot</name>
</property>
</activation>
<properties>
<buildVersion>1.0.3</buildVersion>
</properties>
<distributionManagement>
<repository>
</repository>
<snapshotRepository>
</snapshotRepository>
</distributionManagement>
</profile>
然后使用-Dsnapshot=true