如何跳过maven repo中的发行版或特定模块 [英] How to skip the release or specific modules in the maven repo
问题描述
Heyho,
我有一个maven项目,这个结构:
I have a maven project with this scructure:
父:
- 列表项目
- API模块
- module2
- ...
- module5
- test
- >
- List item
- API module
- module2
- ...
- module5
- test
- distribution/assembly
首先我运行父模块,然后运行构建api的模块,然后依赖于api的模块,然后进行测试模块,其中包含要测试的工具,最后我运行一个程序集/分发,我将一些模块打包在一个存档中。
由于一些问题,我无法真正改变方式,它的工作原理非常完美。
So first i run the parent module, then I run the module which builds the api, then the modules which depend on the api, then a test module which contains tools to test and at the end I run a assembly/distribution where I package some modules in a archive. Because of some problems I can not really change the way and it works so far perfect.
使用jenkins我将它发布到maven repo,但是只想发布例如API,以及几个模块,而不是测试模块和分发模块。
有没有办法跳过它们?
不要发布我真的不需要的东西:/
With the jenkins I release it to the maven repo, but I want only to release for example the API, and a few modules, not the test module and the distribution module. Is there a way to skip them? Dont't want to release stuff I dont really need :/
推荐答案
要正确理解你,你仍然想要运行测试模块,但您不想部署/释放它们。 maven-deploy-plugin 抢救!仍然构建工件,但未部署。
To understand you correctly, you still want to run the test modules, but your don't want to deploy/release them. The maven-deploy-plugin to the rescue! To artifact will still be built, but not deployed.
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-deploy-plugin</artifactId>
<version>2.7</version>
<configuration>
<skip>true</skip>
</configuration>
</plugin>
然而,jenkins发行版插件仍然会释放所有工件。而不是使用jenkins发行版插件,请考虑使用 maven-release-plugin ,这很容易做:
However, the jenkins release plugin will still release all artifacts. Instead of using the jenkins release plugin, think about releasing with the maven-release-plugin, which is easy to do:
mvn release:prepare
mvn release:perform
由于默认目标是部署
和网站
,都应该是好吧,
Since the default goals are deploy
and site
, all should be ok.
只需确保你的根目录中有一个 scm
标签:
Just make sure you have a scm
tag in your root pom:
<scm>
<connection>scm:svn|git:https://...</connection>
<developerConnection>scm:svn|git:https://...</developerConnection>
</scm>
,您的版本控制工具命令(git,svn,...)在PATH上可用。
and that your versioning tool command (git, svn, ...) is available on the PATH.
这篇关于如何跳过maven repo中的发行版或特定模块的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!