What exactly is maven release plugin? What is its purpose? I found it in the middle of a tutorial but don't understand what it is useful for. Also, the teacher is showing us how to create tags on GitHub. What do the maven release plugin and GitHub have in common?
-
Please edit the question to limit it to a specific problem with enough detail to identify an adequate answer. – abdo Salm Sep 26 '22 at 21:56
1 Answers
Fundamentally, "releasing a project" means that you have a version of your project that is stable and that you wish to release to the public ("publishing" could be a good synonym).
The maven release plugin helps you with several tasks that need to be done in order to release a project:
- Make sure that the project uses no SNAPSHOT-dependencies (as SNAPSHOT-dependencies are considered unreleased and thus not necessarily stable)
- Create a tag in your source control management system (in your case GitHub) so that you can come back to the released version e. g. if you need to fix a bug in an older release
- Remove the
-SNAPSHOT
suffix from the project version in yourpom.xml
- Build the project
- Deploy the project to your release repository (usually Maven Central).
- Bump the version string in your
pom.xml
and add-SNAPSHOT
again
Note that you can do all of these steps manually (e. g. you can simply edit your pom.xml
and remove the -SNAPSHOT
suffix and then run mvn deploy
to deploy the project to Maven Central), but the release plugin helps with that as it automates those tasks and makes sure that you don't forget anything.
To answer what GitHub has to do with it: Again, the release plugin automatically creates a tag in your SCM so-that you can check it out some time later if you need to. It does not matter what your SCM is, it can be GitHub, Bitbucket, GitLab or whatever else. It's just that most people use GitHub as their SCM host.

- 2,713
- 18
- 41
-
Thanks @vatbub for your clarification,... can we do it without the vesion-control part? I mean can we omit the github step that you mentioned? – Hamza Mohammed Sep 26 '22 at 20:51
-
also at the last step why do you add -SNAPSHOT again while you remove it in the previous pom edit? – Hamza Mohammed Sep 26 '22 at 21:11
-
By definition, `-SNAPSHOT` indicates that this project is work in progress and a different developer who uses your library has to assume that _you_ can change anything at any time. When you release your project, you are basically saying: This version of the project is stable, it shouldn't break. You indicate this by removing the `-SNAPSHOT` suffix from your pom. In most cases, you want to continue working on your project, even after you released it. Hence, the `-SNAPSHOT` is added again to indicate that this is a work in progress again. – vatbub Sep 27 '22 at 16:22
-
Also, AFAIK, the release plugin requires you to use an SCM, as most of its tasks are SCM-related. – vatbub Sep 27 '22 at 16:24
-
And if you found my answer helpful, could you mind marking it as the solution with the green check mark on the left? That would be great ;) – vatbub Sep 27 '22 at 16:57