歡迎來到Linux教程網
Linux教程網
Linux教程網
Linux教程網
Linux教程網 >> Linux基礎 >> 關於Linux >> Jenkins -- 插件開發之一環境搭建

Jenkins -- 插件開發之一環境搭建

日期:2017/3/1 11:55:28   编辑:關於Linux

1、准備環境

①Maven

②JDK

③Eclipse

2、修改Maven的配置文件

修改maven安裝目錄/conf/settings.xml文件。修改後內容如下:


  
    
    org.jenkins-ci.tools  
    
  
    
      
      
      jenkins  
        
        true   
        
        
          
          repo.jenkins-ci.org  
          http://repo.jenkins-ci.org/public/  
          
        
        
          
          repo.jenkins-ci.org  
          http://repo.jenkins-ci.org/public/  
          
        
      
    
    
      
      repo.jenkins-ci.org  
      http://repo.jenkins-ci.org/public/  
      m.g.o-public  
      
    

3、創建plugin

在命令行中輸入“mvn hpi:create”命令,根據提示信息,輸入groupId和artifactId。

\

4、導入到Eclipse

打開Eclipse,選擇【File】-> 【Import...】-> 【Maven】-> 【Existing Maven Projects】-> 【Next】-> 【Finish】。在【Existing Maven Projects】時,選擇步驟3中通過Maven創建的項目目錄。

將Mavne創建的項目導入到Eclipse時,遇到一個問題:pom.xml文件報錯,錯誤類似:Original error: Could not transfer artifact org.jenkins-ci.plugins:plugin:pom:2.3 from/to repo.jenkins-ci.org。

解決方法(具體參考http://stackoverflow.com/)

①對於Linux操作系統,執行如下操作:

#find ~/.m2  -name "*.lastUpdated" -exec grep -q "Could not transfer" {} \; -print -exec rm {} \;
②對於Windows操作系統,執行如下操作:

#cd %userprofile%\.m2\repository
#for /r %i in (*.lastUpdated) do del %i




Copyright © Linux教程網 All Rights Reserved