我在日食中使用maven(m2 eclipse)
当我执行mvn:install时,我希望我的jar(工件)安装在位于服务器上的nexus存储库中(现在安装的jar放在本地系统存储库中)..我该怎么做?
我甚至将其更改为我的本地存储库地址
我正在使用Ant + Ivy,我的公司最近为我们自己的私人库建立了一个Nexus服务器.Ivy可以通过使用ibilio解析器和m2compatible = true从Nexus服务器获取依赖关系,但我必须将我的凭据放在ivysettings.xml文件中.
不同的开发者应该如何存储他们的凭据?
是不是应该在vcs中提交ivysettings.xml文件?
我真的不想以纯文本格式存储我的密码.
我们有许多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作业层次结构的情况下实现这一目标?
提前致谢!
我有一个由几个团队共享的Jenkins集群,我可以配置构建作业,但是我不能轻易地对Jenkins配置本身进行更改.
有一个中央的"nexus pro"maven存储库管理器,但是这个非常大的跨国公司的每个团队/团队都有自己的repo,发布到repos需要用户名/密码组合.
这意味着我必须使用maven settings.xml配置Jenkins服务器,这对我正在使用的团队来说是唯一的,而不会弄乱Jenkins群集的其他用户的maven配置.
Git是源代码控制库.
我启动并运行了一个Sonatype Nexus实例,需要编写一个脚本来手动下载特定的工件.
我尝试使用REST API和wget:
wget --user=username --password=password http://<ip>:<port>/nexus/service/local/artifact/maven/content?g=<group>&a=<artifact>&v=<version>&r=snapshots
Resolving <ip stuff>
Connecting to <ipv6 stuff>... failed: Connection refused.
Connecting to <ipv4 stuff>... connected.
HTTP request sent, awaiting response... 401 Unauthorized
Reusing existing connection to <ip>:<port>.
HTTP request sent, awaiting response... 400 Bad Request
2014-05-11 20:17:01 ERROR 400: Bad Request.
Run Code Online (Sandbox Code Playgroud)
有谁知道,如何使这个工作?
编辑:我可以使用我的浏览器下载工件(并登录到Web界面)
我一直在使用Nexus发布我的Docker镜像几个月,我非常喜欢它添加到经典Docker Registry中的功能.
最近,我们存储的图像数量导致磁盘空间问题.我环顾了图形界面,显然没有什么可以同时删除多个Docker图像.我知道有一个Nexus任务可以删除未使用的工件,但它似乎只适用于Maven和Nugget.
有没有办法使用Nexus Repository Manager OSS 3.0.1-01同时删除未使用的图像或至少几个图像?
谢谢!
我正在尝试从我当地的Nexus仓库下载最新/最新资产(JAR).我正在使用Nexus Swagger UI.它有一个GET方法下载,
GET /beta/search/assets/download
Run Code Online (Sandbox Code Playgroud)
问题是..我在repo中有很多资产,它给出了一个错误,
Search returned multiple assets, please refine search criteria to find a single asset
Run Code Online (Sandbox Code Playgroud)
如何优化搜索并获取最新/最新的JAR?
仅供参考.目前,我在回购中拥有20多个资产,下面我展示其中两个...
{
"items": [
{
"downloadUrl": "http://localhost:8081/repository/snapshot/com/openshift/test/openshift-jenkins/0.0.1-SNAPSHOT/openshift-jenkins-0.0.1-20180214.211251-17.jar",
"path": "com/openshift/test/openshift-jenkins/0.0.1-SNAPSHOT/openshift-jenkins-0.0.1-20180214.211251-17.jar",
"id": "c25hcHNob3Q6ZTAxODhlZDA3MjhmYTY4ZmIwOGZkYzAyYTliZTQ4Zjg",
"repository": "snapshot",
"format": "maven2",
"checksum": {
"sha1": "53cdfcf964d0edd5fc6fdefa457e700eff47a1ca",
"md5": "d0c82971b82957728d0b4c858150d56c"
}
},
{
"downloadUrl": "http://localhost:8081/repository/snapshot/com/openshift/test/openshift-jenkins/0.0.1-SNAPSHOT/openshift-jenkins-0.0.1-20180214.210246-15.jar",
"path": "com/openshift/test/openshift-jenkins/0.0.1-SNAPSHOT/openshift-jenkins-0.0.1-20180214.210246-15.jar",
"id": "c25hcHNob3Q6MjEwMzFkZmFmNDVlNWI1ODgwZTUwYjE5M2Y5NGVkNjk",
"repository": "snapshot",
"format": "maven2",
"checksum": {
"sha1": "b041f4b1e6bcb81366a72635f6c576ae46a83ec8",
"md5": "af970e3e66c9cd20ff66f1074da04c21"
}
}
],
"continuationToken": null
}
Run Code Online (Sandbox Code Playgroud) 这是场景:
两个Maven 3项目构建.
Build 1具有部署到Nexus的快照jar.
Build 2依赖于快照,引用类似1.0.0-SNAPSHOT,使用该mvn clean package assembly:single
命令打包并压缩.
我们遇到的问题:偶尔在创建程序集时,jar的MANIFEST文件有时会说some.jar.1.0.0-SNAPSHOT,有时它会说some.jar.1.0.0-datetime戳,因此导致类未定义错误.
有没有办法在清单文件中阻止此命名问题?
- 编辑 -
进一步的研究发现了以下内容:
"如果快照是从一个仓库解决的,那么它将被加上时间戳,如果它来自反应堆或本地仓库,那么它将是-SNAPSHOT.该插件调用maven解析逻辑,因此这是核心maven行为."
这是正在遇到的确切问题.第二个构建清单文件总是有一个./lib/Framework-1.0.0-SNAPSHOT.jar条目,其中实际的jar文件名在./lib/Framework-1.0.0-SNAPSHOT.jar和./lib/之间变化Framework-1.0.0-timestamp.jar基于上面的引用.
我可以在Maven settings.xml中使用单个服务器凭据拥有多个存储库吗?
我们使用Maven 3.0.4将工件部署到Nexus pro 2.2.1版
我们在同一台服务器上有多个存储库,用户使用相同的凭据访问所有这些存储库.
settings.xml具有相同凭据的多个存储库:
<repositories>
<repository>
<id>Staging-group</id>
<url>http://server/nexus/content/groups/Staging-group</url>
<repository>
<id>RELEASES</id>
<url>http://server/nexus/content/repositories/RELEASES</url>
</repository>
<repository>
<id>INTERNALS</id>
<url>http://server/nexus/content/repositories/INTERNALS</url>
</repository>
<repository>
<id>SNAPSHOTS</id>
<url>http://server/nexus/content/repositories/SNAPSHOTS</url>
</repository>
</repositories>
.....
<servers>
<server>
<id>Staging-group</id>
<username>user</username>
<password>password</password>
</server>
<server>
<id>RELEASES</id>
<username>user</username>
<password>password</password>
</server>
<server>
<id>SNAPSHOTS</id>
<username>user</username>
<password>password</password>
</server>
<server>
<id>INTERNALS</id>
<username>user</username>
<password>password</password>
</server>
</servers>
Run Code Online (Sandbox Code Playgroud)
Nexus使用Active Directory身份验证.因此,每次用户更改其Windows密码时,他们都需要更改settings.xml
文件中的所有四个条目
有没有办法为所有存储库声明一次凭据?
谢谢,Eyal
使用Maven,您可以获得Maven存储库.像Nexus ou Artifactory这样的工具能够镜像(或代理)远程存储库和自托管存储库,以暴露所有可下载工件(或Bower术语中的依赖关系)的聚合视图.对于像Ivy oy Gradle这样的其他依赖管理器,您可以获得相同的机制(Maven,Ivy/Ant和Gradle不仅仅是依赖管理器,但这不是重点).
使用Bower,您可以设置从中下载依赖项的远程注册表.但是,企业环境中的一件好事就是拥有一个自托管存储库,就像上面描述的那样.
我在网上搜索但没有找到任何令人信服的解决方案.你知道他们中的任何一个吗?
nexus ×10
maven ×6
java ×2
jenkins ×2
repository ×2
sonatype ×2
ant ×1
bower ×1
credentials ×1
dependencies ×1
devops ×1
docker ×1
ivy ×1
javascript ×1
linux ×1
maven-2 ×1
maven-plugin ×1
snapshot ×1
wget ×1