Sia*_*noq 14 java nexus maven jenkins
我们有许多Java项目,它们是使用Jenkins构建的CI.这些部署到我们自己的Nexus服务器就好了.问题是,我们需要将这些库提供给第三方,但没有源代码.因此,对于每个项目,在Nexus中我们有:
问题是:在Jenkins/Nexus世界中,这通常是如何处理的?我宁愿在Jenkins中有一个单独的Job,它可以"自动"处理CI构建和发布(artefact部署)过程.目前我<distributionManagement>
在"main root pom.xml"中使用了多个配置文件(包含在所有项目中):
[...]
<profiles>
<profile>
<id>default</id>
<distributionManagement>
<repository>
<id>releases</id>
<name>Release</name>
<url>http://path/to/nexus/content/repositories/releases/</url>
</repository>
<snapshotRepository>
<id>snapshots</id>
<name>Snapshot</name>
<url>http://path/to/nexus/content/repositories/snapshots/</url>
<uniqueVersion>false</uniqueVersion>
</snapshotRepository>
</distributionManagement>
</profile>
<profile>
<id>third-party</id>
<distributionManagement>
<repository>
<id>releases</id>
<name>Release</name>
<url>http://path/to/nexus/content/repositories/third-party/</url>
</repository>
<snapshotRepository>
<id>snapshots</id>
<name>Snapshot</name>
<url>http://path/to/nexus/content/repositories/third-party-snapshots/</url>
<uniqueVersion>false</uniqueVersion>
</snapshotRepository>
</distributionManagement>
</profile>
</profiles>
Run Code Online (Sandbox Code Playgroud)
在Maven文档中,似乎无法在同一构建生命周期中使用多个存储库,更不用说我们需要/不需要基于目标存储库的源.
我可以使用Maven"目标和选项"在Jenkins中创建一个Job,clean deploy -P third-party
然后使用"默认"数据添加Post-build操作 - "将工件部署到Maven存储库" - 但在这种情况下,仅SNAPSHOTs将通过Jenkins Maven Release Plug-in发布的repo和artefacts 仅进入一个存储库.
任何实用的想法如何在不过度复杂CI作业层次结构的情况下实现这一目标?
提前致谢!
您可以在 Nexus 中处理这一切。创建一个存储库目标,其中包含与预配置示例“除源之外的所有(Maven 2)”中使用的模式类似的模式,并使用限制 groupid、artifactid 甚至版本的另一种模式进一步缩小该目标的范围。
然后创建一个使用该存储库目标的权限,并将其分配给您希望具有相应访问权限的用户或角色。
无需进行多次部署或诸如此类..
请参阅http://books.sonatype.com/nexus-book/reference/repository-targets.html
归档时间: |
|
查看次数: |
14552 次 |
最近记录: |