1. 預備環境
artifactory ( 開源版本 )
maven
jenkins
jenkins artifactory plugin (在插件管理安裝即可)
2. 配置artifactory
a. maven local 倉庫
b. jenkins 配置(添加 artifactory 賬戶信息)
3. jenkins pipeline 配置(實例使用github 實例)
jenkinsfile 內容如下:
node("docker-64") {
def server = Artifactory.newServer url: "http://xxxxxx:8081/artifactory", credentialsId: 'jfrog-artifactory'
def rtMaven = Artifactory.newMavenBuild()
def buildInfo
stage ('Clone') {
git url: 'https://github.com/jfrogdev/project-examples.git'
}
stage ('Artifactory configuration') {
rtMaven.tool = '64maven' // Tool name from Jenkins configuration
rtMaven.deployer releaseRepo: 'aliyun', snapshotRepo: 'aliyun', server: server
buildInfo = Artifactory.newBuildInfo()
}
stage ('Exec Maven') {
rtMaven.run pom: 'maven-example/pom.xml', goals: 'clean install', buildInfo: buildInfo
}
stage ('Publish build info') {
server.publishBuildInfo buildInfo
}
}
4. jenkins 構建效果
5. artifactory 效果
6. 總結
總的來說還是比較好用的,結合jenkins pipeline 可能方便的進行信息的查看,同時jfrog artifactory 的功能也是比較強大的,可以方便我們進行歷史構建信息的查詢
7. 參考資料
https://wiki.jenkins.io/display/JENKINS/Artifactory+Plugin
http://www.jfrogchina.com/open-source
