2016-11-20 11 views
0

NexusのArtifact Uploadを使用して、Nexusにパイプラインでアーティファクトをアップロードします。このコードを使用してデプロイすると、1つのアーティファクトを展開するために完全に機能します。しかし、どのように私はmultipeアーティファクトを展開することができます:docに複数のアーティファクトをネクサスにデプロイする方法は?

Stage 'Nexus Deploy' 
    nexusArtifactUploader 
     artifactId: 'com.example.project', 
     file: 'server/jetty-project/target/jetty-project-0.0.1-SNAPSHOT.war', 
     groupId: 'test-javaproject', 
     type:'war', 
     nexusPassword: 'admin123', 
     nexusUrl: 'XX.XX.XX.XX:8080/nexus', 
     nexusUser: 'admin', 
     nexusVersion: 'nexus3', 
     protocol: 'http', 
     repository: 'maven-snapshots', 
     version: '0.0.1-SNAPSHOT' 

を、それがその

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') 
     } 
     } 
    } 
} 

のように複数のアーティファクトを展開することは可能だと述べている。しかし、私はjenkinsfileにそれを作る方法を思ったんだけど?

答えて

2

JenkinsfileのnexusArtifactUploaderの構文は次のとおりです。

nexusArtifactUploader artifacts: [ 
    [artifactId: 'nexus-artifact-uploader', classifier: 'debug', file: 'nexus-artifact-uploader.jar', type: 'jar'], 
    [artifactId: 'nexus-artifact-uploader', classifier: 'debug', file: 'nexus-artifact-uploader.hpi', type: 'hpi'] 
], 
credentialsId: '44620c50-1589-4617-a677-7563985e46e1', 
groupId: 'sp.sd', 
nexusUrl: 'localhost:8080/nexus', 
nexusVersion: 'nexus2', 
protocol: 'http', 
repository: 'NexusArtifactUploader', 
version: '2.4' 

パイプラインスニペットジェネレータから上記の構文を生成できます。

関連する問題