2014-02-07 52 views
1

我們有一個Maven項目在一個Git倉庫結構具有以下文件夾:行家釋放小插件部署目標在Git倉庫中頂級項目失敗,文件夾

Parent project folder 
------> pom.xml 
------> Child 1 project folder 
------> ------> pom.xml 
------> Child 2 project folder 
------> ------> pom.xml 

我們現在正在嘗試使用maven-release-plugin爲了去發佈代碼。

當運行「MVN發佈:準備發佈:執行」,準備階段工作正常,但在執行階段的運行,我們得到以下錯誤:

[INFO] --- maven-release-plugin:2.0:perform (default-cli) @ PARENTPROJECT --- 
[INFO] Checking out the project to perform the release ... 
[INFO] Executing: cmd.exe /X /C "git clone ssh://GITREPO.git "C:\CI\Jenkins\jobs\test 6\workspace\Parent project folder\target\checkout" 
" 
[INFO] Working directory: C:\CI\Jenkins\jobs\test 6\workspace\Parent project folder\target 
[INFO] Executing: cmd.exe /X /C "git fetch ssh://GITREPO.git" 
[INFO] Working directory: C:\CI\Jenkins\jobs\test 6\workspace\Parent project folder\target\checkout 
[INFO] Executing: cmd.exe /X /C "git checkout PARENTPROJECT-0.0.0.0.2" 
[INFO] Working directory: C:\CI\Jenkins\jobs\test 6\workspace\Parent project folder\target\checkout 
[INFO] Executing: cmd.exe /X /C "git ls-files" 
[INFO] Working directory: C:\CI\Jenkins\jobs\test 6\workspace\Parent project folder\target\checkout 
[INFO] Executing goals 'deploy'... 
[WARNING] Maven will be executed in interactive mode, but no input stream has been configured for this MavenInvoker instance. 
[INFO] [INFO] Scanning for projects... 
[INFO] [INFO] ------------------------------------------------------------------------ 
[INFO] [INFO] BUILD FAILURE 
[INFO] [INFO] ------------------------------------------------------------------------ 
[INFO] [INFO] Total time: 0.063s 
[INFO] [INFO] Finished at: Fri Feb 07 15:07:26 GMT 2014 
[INFO] [INFO] Final Memory: 1M/15M 
[INFO] [INFO] ------------------------------------------------------------------------ 
[INFO] [ERROR] The goal you specified requires a project to execute but there is no POM in this directory (C:\CI\Jenkins\jobs\test 6\workspace\Parent project folder\target\checkout). Please 
verify you invoked Maven from the correct directory. -> [Help 1] 

當尋找在C:\ CI \詹金斯\ jobs \ test 6 \ workspace \ Parent項目文件夾\ target \ checkout文件夾,那裏確實沒有POM文件。這是因爲'git checkout'已經簽出了與'Parent project folder'相對應的已創建的標籤。

因此,在checkout文件夾中,我們有'Parent project folder'並且沒有POM文件,因爲POM存在於'父項目文件夾'中,而不是在存儲庫頂層。

我們知道解決此問題的方法是將POM移動到存儲庫頂層(即「父項目文件夾」之外)的右側,但希望探索是否存在其他解決方案。

我們在SVN中有一個類似的項目設置,並且發佈插件工作正常。這似乎是因爲當標籤被創建時,只有'Parent project folder'內的內容出現在標籤中,所以POM被簽出到目標中。在git中,實際的「父項目文件夾」被標記,所以這被檢出到目標中,並且POM也在其中。

有什麼我們可以做的,當實際運行發佈插件告訴它運行目標,如部署從'C:\ CI \ Jenkins \作業\測試6 \工作區\父項目文件夾\目標\ checkout \ Parent project folder'而不是'C:\ CI \ Jenkins \ jobs \ test 6 \ workspace \ Parent project folder \ target \ checkout'?

我期待這是一個長鏡頭,但認爲這值得提問。

回答

4

因此,如果我正確地閱讀你,聽起來像問題是,當release:perform內部呼籲mvn deploy它找不到父pom文件,因爲它被埋在一個子目錄更深一層。

然後在溶液中告訴內心的召喚在哪裏可以找到POM文件:

mvn release:perform 

mvn release:perform -Dgoals='deploy -f parent_project_folder/pom.xml' 

希望有所幫助。

+0

輝煌 - 正是我需要的。 – chrishern