Home > Software engineering >  Maven release avoid huge repository checkout
Maven release avoid huge repository checkout

Time:11-12

I try to release a maven project to the new version.

Therefore I use

mvn release:prepare release:perform

To release that version is not a big deal. Unfortunately it is a big project and have more than 700 releases in the past. Every release have its own tag.

Example:

repo 
   branches
   tags
      project-1.0.0
      project-1.0.1
      project-1.0.2
      project-1.0.3
         (...)
      project-7.9.2
   trunk
      src
      pom.xml

Using the release-plugin it download all the tags making it about 190 GB of code and old tags.

This is a problem because it takes a hours to checkout all the tags.

I can not simply "remove old tags". This will make the release:prepare release:perform brake the release-process having the message:

[INFO] de.e_nexus.projekt.xdiff ........................... SKIPPED ?
[INFO] ------------------------------------------------------------------------ ?
[INFO] BUILD FAILURE    ?
[INFO] ------------------------------------------------------------------------ ?
[INFO] Total time: 05:52 min (Wall Clock)   ?
[INFO] Finished at: 2022-11-10T22:23:19 01:00   ?
[INFO] ------------------------------------------------------------------------ ?
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-release-plugin:2.5.3:prepare (default-cli) on project projekt: Unable to tag SCM  ?
[ERROR] Provider message:   ?
[ERROR] The svn tag command failed. ?
[ERROR] Command output: ?
[ERROR] svn: E160013: File not found: revision 3861, path '/repo/tags/projekt-1.0.0'    ?
[ERROR] -> [Help 1] ?
[ERROR] ?
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch. ?
[ERROR] Re-run Maven using the -X switch to enable full debug logging.  ?
[ERROR] ?
[ERROR] For more information about the errors and possible solutions, please read the following articles:   ?
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException

How to get rid of old tags AND be able to release using mavens release plugin?

CodePudding user response:

Check out only the trunk of your project. You don't need to checkout all your tags and branches to create a new tag out of trunk.

If I should only checkout trunk only, how is the release-process capable of creating release-tags? How can you tell the error-message pointing out of trunk-folder?

Maven uses a Subversion client to create a new tag in the repository. This does not require all the tags to be present on the client side. Check examples in SVNBook | Tags. The examples show that you can create a 'URL to URL' tag (no working copy at all) or a 'working copy to URL' tag (tagging the current state of the working copy). No need to have the all the tags locally.

Additional examples are also available in SVNBook | svn copy.

Since tagging is a very common operation, I'm sure that Maven knows how to do it properly. But you need to examine and fix your configuration.

PS Great multi-display setup in your profile @Grim!

  • Related