我有几个部署到nexus服务器的maven项目。我不喜欢通过pom文件管理他们的版本,并且已经通过git-describe使用git标签进行版本控制。
我使用以下配置添加了git-describe maven plugin:
<plugin>
<groupId>com.lukegb.mojo</groupId>
<artifactId>gitdescribe-maven-plugin</artifactId>
<version>1.3</version>
<executions>
<execution>
<goals>
<goal>gitdescribe</goal>
</goals>
<id>git-describe</id>
<phase>initialize</phase>
<configuration>
<outputPrefix></outputPrefix>
</configuration>
</execution>
</executions>
</plugin>
并且它适用于mvn package
次运行 - 但是当我使用mvn deploy
时,我最终会看到:
nexus/content/repositories/releases/me/botsko/project/${describe}/project-${describe}.jar
我试图与插件作者交谈,但这已经过了几天而没有回复。
如何在deploy
阶段修改插件或我的配置属性设置版本?
答案 0 :(得分:0)
可能有一种编辑插件的方法,但我不熟悉maven插件架构的工作原理。
我通过编写一个shell脚本来解决问题,该脚本将相同的git-describe值传递给maven部署过程:
#!/bin/sh
gitvers=`git describe`
mvn deploy -Ddescribe=$gitvers-SNAPSHOT
请确保在POM中使用<version>${describe}</version>
或类似内容。