JavaMaven自定义版本最佳实践
我希望改进在maven中管理版本的方式,以便在应用程序界面和清单文件中查看版本。目前,我在我的根pom。xml包含以下属性:
<properties>
<build.number>268</build.number>
<svn.revision>10096</svn.revision>
<jira.version>1.0.19</jira.version>
<project.web.version>${jira.version}.${svn.revision}_${build.number}</project.web.version>
</properties>
在我耳边。xml I将以下属性添加到清单文件:
<manifest>
<addDefaultImplementationEntries>true</addDefaultImplementationEntries>
</manifest>
<archive>
<manifestEntries>
<Specification-Title>${project.name}</Specification-Title>
<Specification-Version>${svn.revision}</Specification-Version>
<Implementation-Version>${build.number}</Implementation-Version>
</manifestEntries>
</archive>
在web模块pom中。XMLI使用一个插件来替换脚本中的版本,该脚本中的版本将在应用程序界面中显示为project中的值。网状物版本
<groupId>com.google.code.maven-replacer-plugin</groupId>
<artifactId>replacer</artifactId>
<version>1.5.3</version>
<executions>
<execution>
<phase>prepare-package</phase>
<goals>
<goal>replace</goal>
</goals>
</execution>
</executions>
<configuration>
<ignoreMissingFile>true</ignoreMissingFile>
<file>${basedir}\src\main\webapp\Commons\Libraries\jsAppVersion.js</file>
<token>(\").*?(\")</token>
<regex>true</regex>
<value>"${project.web.version}"</value>
</configuration>
</plugin>
使用maven:package-Dbuild设置值。数字=277-Dsvn。修订版=10235-Djira。版本=1.0.20 有什么改进的办法吗
共 (0) 个答案