-
安装 【nexus-artifact-uploader】 插件。
操作路径: 【系统管理】>【插件管理】>【可选插件】 ,搜索 nexus-artifact-uploader 插件并安装。
-
使用【nexus-artifact-uploader】上传制品到nexus
下面介绍FreeStyle和Pipeline 两种模式,如何通过nexus-artifact-uploade上传制品到Nexus中,以下仅为示例配置,请根据实际情况填写
2.1 如使用FreeStyle project,则在Build Steps中选择【Nexus artifact uploader】并填写相关配置
示例配置:
freeStyleJob('NexusArtifactUploaderJob') {
steps {
nexusArtifactUploader {
nexusVersion('nexus2')
protocol('http')
nexusUrl('localhost:8080/nexus')
groupId('sp.sd')
version('2.4')
repository('NexusArtifactUploader')
credentialsId('44620c50-1589-4617-a677-7563985e46e1')
artifact {
artifactId('nexus-artifact-uploader')
type('jar')
classifier('debug')
file('nexus-artifact-uploader.jar')
}
artifact {
artifactId('nexus-artifact-uploader')
type('hpi')
classifier('debug')
file('nexus-artifact-uploader.hpi')
}
}
}
}
2.2 如使用Pipeline 则在pipeline中添加如下配置
nexusArtifactUploader(
nexusVersion: 'nexus3',
protocol: 'http',
nexusUrl: 'my.nexus.address',
groupId: 'com.example',
version: version,
repository: 'RepositoryName',
credentialsId: 'CredentialsId',
artifacts: [
[artifactId: projectName,
classifier: '',
file: 'my-service-' + version + '.jar',
type: 'jar']
]
)
06-25
734
08-16
190
10-08
1098