简体   繁体   中英

mvn release:prepare going into unending cycle

I ran

mvn release:prepare for a project and it is a multi-module build.

I entered yes for the following question :

There are still some remaining snapshot dependencies.: Do you want to
resolve them now? (yes/no) no: : yes
Dependency type to resolve,: specify the selection number ( 0:All 1:Project Dependencies 2:Plugins 3:Reports 4:Extensions ): (0/1/2/3) 1: :0
Resolve All Snapshots.: 'com.test:core-api' set to release? (yes/no) yes: : yes
What is the next development version? (0.0.6-SNAPSHOT) 0.0.6-SNAPSHOT: : 1.2.0-SNAPSHOT

and it keeps on asking me the following in an unending cycle.

What is the next development version?

I have to Ctrl+C to exit the loop.

I ran into this same issue when I refactored the groupId in my multi-module build.

The cause is exactly what the error message says, but it can be elusive to spot the snapshots dependency.

In my case, the toplevel groupId and the groupId s in the <parent> stanzas in the submodules were all correct, but also some modules in the tree have cross dependencies to other modules, and as such are included in the <dependencies> or <dependencyManagement> stanzas.

These dependencies are tied to the project version by, well, ${project.version} , so they're easy to miss in a text search for 'SNAPSHOT'. Since I forgot to refactor the groupId s in these dependencies, maven sees it as a 'foreign' snapshot dependency, outside of the project itself.

From past experience it's not an un-ending cycle, but a HUGE amount of snapshots dependencies need to be confirmed (hence you get the impression it's an infinite loop). This typically happen in a maven aggregation (multi module) project.

If you know you always accept the DEFAULT answer, you can try running it in batch mode

mvn --batch-mode release:prepare

The default behavior of release plugin is to ask confirmation everytime it detects a snapshot dependencies. If you follow maven common practice, release your snapshot dependencies first and update reference to the dependencies before releasing your project.

http://maven.apache.org/maven-release/maven-release-plugin/examples/non-interactive-release.html has a good information on performing non-interactive release

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM