2016-08-15 57 views
0

我正在將現有的maven項目轉換爲自由式項目,其中將部署到存儲庫的構建後步驟僅與maven項目一起使用。對自由式項目使用maven-deploy

什麼是自由式項目類型實現下面的等價物。有什麼方法可以直接使用mvn deploy作爲後構建步驟,將構建結束時的構件推送到構件服務器(nexus)?

現在,例如,當您使用JJB運行以下示例時,可以看到作業得到更新,但Deploy Artifacts to maven repository針對自由式項目類型顯示,但由於僅與maven項目類型一起使用,因此無法按預期工作。

- job: 
    name: test-freestyle 
    project-type: freestyle 
    description: 'example for freestyle' 
    builders: 
     - shell: | 
      echo 'Hello world' 
      cat /etc/passwd 
    publishers: 
     - maven-deploy: 
      id: example 
      url: http://repo.example.com/maven2/ 
      unique-version: true 
      deploy-unstable: false 
      release-env-var: TIMER 

回答

0

工作的解決方案,我發現是使用一個- maven-target下的建設者部分如下:

- job: 
    name: test-freestyle 
    project-type: freestyle 
    description: 'example for freestyle' 
    builders: 
     - shell: | 
      echo 'Hello world' 
      cat /etc/passwd 
     - maven-target: 
      maven-version: '{mvn33}' 
      pom: pom.xml' 
      goals: 'clean install deploy -DdeployAtEnd=true ...' 
      settings: '{mvn-settings}' 

注:研究發現,maven的部署插件有一些issue上載的文物當使用DeployAtEnd選項,在這種情況下,簡單地使用deploy沒有選項。