【发布时间】:2019-01-14 14:35:35
【问题描述】:
我是新手。我有一个 .NET 项目,GIT 被用作 SCM。我们将第三方二进制文件(在 zip 文件中)保存在 Nexus 中。
现在,在通过 Jenkins 构建项目时,我需要从 Nexus 复制并解压缩二进制文件以通过 Jenkins 流水线脚本构建机器。
【问题讨论】:
标签: jenkins groovy jenkins-pipeline nexus
我是新手。我有一个 .NET 项目,GIT 被用作 SCM。我们将第三方二进制文件(在 zip 文件中)保存在 Nexus 中。
现在,在通过 Jenkins 构建项目时,我需要从 Nexus 复制并解压缩二进制文件以通过 Jenkins 流水线脚本构建机器。
【问题讨论】:
标签: jenkins groovy jenkins-pipeline nexus
您可以使用Maven dependency plugin。
一个非常基本的例子是:
sh "mvn dependency:get -DrepoUrl=YOUR_URL Dartifact=com.foo.something:component:LATEST:jar -Ddest=component.jar"
当然,这需要在您的节点上正确安装 java 和 maven。
【讨论】:
<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd"> <servers> <server> <id>YOUR_ID</id> <username>USERNAME</username> <password>PASSWORD</password> </server> </servers> </settings>