Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Maven Release Plugin and Git Tagging Style

Does the Maven Release Plugin perform lightweight or annotated tags in Git? (Also, does it support annotated tags if it is defaulting to lightweight tags?)

For instance, I can tag a project by hand using either:

git tag v1.0.0 # lightweight

or, alternately,

git tag -a v1.0.0 # annotated

These are very different types of tags. The first is a lightweight Git tag, and the second is an annotated Git tag.

(Note: I know that the release:prepare goal performs commits with POM changes, which in effect simulates an annotated tag because it ties the tag to a new, specific commit, but my question is whether an annotated tag is the result, anyway.)

Background: Maven 3.3.9 and Git 2.7.4 on a Mavenized Java project. Not easy to find this answer on Google or in SO.

UPDATE: Tags by the Maven Release Plugin are always annotated. There is no support for lightweight tags. See the answer below and my comments to corroborate it.

like image 229
ingyhere Avatar asked Jan 19 '17 20:01

ingyhere


People also ask

What is Git tag and release?

A Git release is a GitHub object that helps show official program versions on your project page. The object allows showing a specific commit point, a Git tag, with a release status. Managing releases is an easy and straightforward process performed on the GitHub website.

What is tagging in release?

Tags are ref's that point to specific points in Git history. Tagging is generally used to capture a point in history that is used for a marked version release (i.e. v1. 0.1). A tag is like a branch that doesn't change. Unlike branches, tags, after being created, have no further history of commits.

What is Maven release plugin?

This plugin is used to release a project with Maven, saving a lot of repetitive, manual work. Releasing a project is made in two steps: prepare and perform. Note: Maven 3 users are encouraged to use at least Maven-3.0. 4 due to some settings related issues.

What does Mvn Release perform do?

release:perform will fork a new Maven instance to build the checked-out project. This new Maven instance will use the same system configuration and Maven profiles used by the one running the release:perform goal.


1 Answers

While I didn't find documentation on this question (maybe it exists out there), I did a trial run. Create a local GIT repository with a simple POM and do a maven release:prepare. When I run git show $MYTAG on the resulting tag, git output contains "Tagger" data which suggests it is an annotated tag.

https://git-scm.com/book/en/v2/Git-Basics-Tagging

https://maven.apache.org/maven-release/maven-release-plugin/prepare-mojo.html

like image 79
Mark Taylor Avatar answered Sep 30 '22 11:09

Mark Taylor