之前老是想改maven打包的包名,因为现有项目的包名测试环境和生产环境没做区分,自己部署Jar包害怕部署错了于是想找办法改变包名 需求:按照打包环境来区分包名,比如sit环境 打包成xxxx-xxx-sit.jar maven配置: 在各自的profile属性中增加如下属性:
<properties>
<fname>dev</fname>
</properties>
<profiles>
<profile>
<id>dev</id>
<properties>
<fname>dev</fname>
</properties>
<build>
<plugins>
<plugin>
在包名添加属性标签 fname
<finalName>${project.artifactId}-${maven.build.timestamp}-${fname}</finalName>
然后执行打包命令 搞定~~