0

I have a continuous integration build process where each change gets compiled and deployed as a Maven snapshot. When a version is compiled and tested that people are happy with, I want to be able to deploy this to our local Maven repository with a release version.

"The Maven way" to do this would be to take the source again, set a version (versions:set etc), compile and test it all over again then deploy the resulting artifacts. As this process takes some time, I would prefer not to go through all the steps again.

Is there a way of taking the artifacts produced by the first compile step, update the version and deploy them as is without recompiling?

4

1 回答 1

0

你认为是“Maven 方式”的不一定是真的。但是,如果您确实想将任意 jar 部署为不同组/名称/版本的 maven 工件,您可以使用 maven deploy 插件来执行此操作:

mvn deploy:deploy-file -Durl=/path/to/remote/repository -Dfile=/path/to/myjar-1.22.jar -DgroupId=somegroup -DartifactId=yourjar -Dpackaging=jar -Dversion=1.23

上面的示例将 myjar-1.22 作为 yourjar-1.23 部署到远程存储库中。

但是,您应该对此保持谨慎。通常在项目本身内部使用原始版本信息(作为 jar 元数据等)

在我看来,最好的方法不是更改版本号,而是在软件生命周期中一直坚持下去。利用源代码控制修订/内部版本号,以便您始终获得唯一的版本标签。例如,命名您的工件myjar-1.0.3345.23.jar,其中 1.0 是您的主要/次要版本,3345 是您的源代码控制修订号,23 是内部版本号

于 2013-02-20T21:43:30.513 回答