我試圖用Maven發佈一個項目。我的項目POM包含-SNAPSHOT依賴項,所以爲了自動執行發佈,我想使用以下maven命令,基於「maven-release-plugin」目標:mvn release:prepare-with-pom以便準備項目的pom.xml以發佈並自動解決依賴性-SNAPSHOT版本,而無需手動編輯。 不幸的是我發現這隻能在命令行的交互模式下工作。這個想法是,我想知道這是否可以在沒有任何手動交互的情況下完成。我使用Bamboo作爲CI服務器,我希望將其納入計劃並自動執行此項目。 - 非交互式或-B參數不起作用,實際上如果我使用-B或 - 非交互式參數,maven目標失敗Maven發佈:準備與pom非交互式
輸出爲mvn release:prepare-with- POM是這樣的:
H:\APPS\dev\cmtest\test-dependency\trunk>mvn release:prepare-with-pom -DdryRun=t
rue
[INFO] Scanning for projects...
[INFO] ------------------------------------------------------------------------
[INFO] Building test-dependency 0.0.4-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-release-plugin:2.0:prepare-with-pom (default-cli) @ test-depend
ency ---
[INFO] Resuming release from phase 'check-dependency-snapshots'
[INFO] Checking dependencies and plugins for snapshots ...
There are still some remaining snapshot dependencies.: Do you want to resolve th
em now? (yes/no) no: : yes
Dependency type to resolve,: specify the selection number (0:All 1:Project Depe
ndencies 2:Plugins 3:Reports 4:Extensions): (0/1/2/3) 1: : 1
Resolve Project Dependency Snapshots.: '${artifactGroup}:${artifactId}' set to releas
e? (yes/no) yes: : yes
What is the next development version? (0.1.3-SNAPSHOT) 0.1.3-SNAPSHOT: :
'${artifactGroup}:${artifactId1}_1' set to release? (yes/no) yes: : yes
What is the next development version? (0.0.2-SNAPSHOT) 0.0.2-SNAPSHOT: :
'${artifactGroup}:parent-pom' set to release? (yes/no) yes: : yes
What is the next development version? (0.0.3-SNAPSHOT) 0.0.3-SNAPSHOT: :
What is the release version for "test-dependency"? (${artifactGroup}:${artifactId1}_2) 0.0.4: :
What is SCM release tag or label for "test-dependency"? (${artifactGroup}:${artifactId1}_2) test-dependency-0.0.4: :
What is the new development version for "test-dependency"? (${artifactGroup}:${artifactId1}_2) 0.0.5-SNAPSHOT: :
[INFO] Transforming '${artifactId1}_2'...
[INFO] Updating ${artifactId1}_1 to 0.0.1
[INFO] Updating ${artifactId1} to 0.1.2
[INFO] Generating release POMs...
[INFO] Generating release POM for 'test-dependency'...
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
所以,你能幫助我,請找一招,以在非交互模式下執行此命令行家? 非常感謝
是的,我沒有考慮到這一點。我的想法是,我有一個父pom.xml,我保留所有的子項目版本。我已經選擇了這種方式,以便隨時瞭解每個版本的子項目版本。 我遇到的問題是關於發佈過程,因爲當我想發佈一個子項目時,它會要求父項目發佈版本。所以我在這裏有一個循環問題:我不能首先發布我的parent.pom,因爲我需要讓所有我的子項目發佈版本聲明,並且我不能首先釋放子項,因爲它們需要父項發佈 – Asgard