上下文:我没有 Nexus 存储库的 UI 访问权限,但我可以访问配置了 Nexus 存储库访问权限的 Jenkins。我的 git 存储库中有一个阴影 jar,需要使用 maven 直接上传到 nexus 存储库,而不需要 pom.xml 或 settings.xml 文件。
问题:如何使用 Jenkins 和 maven 插件将 git repo 中的 jar 上传到 nexus 存储库?
我尝试搜索这个特定的用例,但无法找到解决方案。
您可以创建一个 Jenkins 作业来克隆 git 存储库 [源代码管理],其中存在所需的 jar,并使用以下 maven 命令 [执行 Shell] 配置 Jenkins 作业构建阶段:
mvn deploy:deploy-file \
-DgroupId=com.example.test \
-DartifactId=test-module \
-Dversion=1.0.0 \
-DgeneratePom=true \
-Dpackaging=jar \
-DrepositoryId=sample-rel \
-Durl=http://nexus.private.net/Your_Nexus_Repository_Path \
-Dfile=./PATH_TO_JAR_FILE
Run Code Online (Sandbox Code Playgroud)
(编辑:多行以便易读)
| 归档时间: |
|
| 查看次数: |
8630 次 |
| 最近记录: |