Can Maven release: prepare snapshot version for batch release version

mvn release: prepare

He constantly asks me to resolve snapshot dependencies. Is there a way to do this in batch mode so that maven will automatically use the associated release. that is, if the dependency is 1.0.0-SNAPSHOT, will it automatically update this dependency to version 1.0.0?

[INFO] Checking dependencies and plugins for snapshots ... 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: : 1 Resolve Project Dependency Snapshots.: 'com.my.project' set to release? (yes/no) yes: : yes What is the next development version? (0.0.2-SNAPSHOT) 0.0.2-SNAPSHOT: : 0.0.2-SNAPSHOT 
+8
maven version release prepare
source share
3 answers

You can update SNAPSHOT via versions-maven-plugin before release.

+5
source share

Note that you can configure Maven to ignore SNAPSHOT dependency checking with allowTimestampedSnapshots , according to the maven-release plugin documentation:

allowTimestampedSnapshots:

Whether to allow SNAPSHOT time snaps. By default, crashes when searching for SNAPSHOT.

  • Type: boolean
  • Starting from: 2.0-beta-7
  • Mandatory parameter: No
  • Expression: $ {ignoreSnapshots}
  • Default: false

Or just run the following command:

mvn release: prepare -DignoreSnapshots = true

However, it is still recommended that you resolve all SNAPSHOT dependencies before the final release, as this agreement is used by most people. You should always take this into account manually at the development stage, rather than automatically dispensing at the release stage, since the dependencies of the change / update project (both your own and a third-party bank) can sometimes lead to an error or incompatibility and disrupt your project, which usually requires attention developers and fix them before making the final release.

In another word, resolving dependencies is not a task that should be performed at the release stage, moreover, it is not a task that should be performed automatically without the attention of developers.

+8
source share

If your addiction is your own program and its life cycle is closely related to the one you are trying to release, you might consider using a project with several modules: http://maven.apache.org/guides/mini/guide-multiple-modules .html The Maven Release Plugin will update the version for all of your dependency modules.

If not, you are probably doing what you shouldn't. Simply changing 1.0.0-SNAPSHOT to 1.0.0 does not guarantee that the application will continue to work. So I don’t think Maven should!

Additional considerations

The Maven release plugin checks to see if you are using a snapshot dependency, because a snapshot is, by definition, an unstable vesions. This may change over time. This means that today work cannot work.

Releasing means your version is stable and the assembly can be played at any time without any changes. Using the snapshot version, this statement becomes false.

So,

+3
source share

All Articles