I want to create a maven goal which will create versioned jar like when I create a jar first time it will create a jar with version 1.0 then second time create a jar with version 1.1 then 1.2 and so on... means if latest jar version is 1.2 then next time when I build it, it will create a jar with version 1.3. is it possible?
or I need to provide the jar with version to create each time I build a jar. or I need to create a maven goal which will do all this, is it possible ? If there is some solution for this then please guide me.
Update:
As per the following answer I have used buildnumber-maven-plugin with timestamp to create build with timestamp and it works as expected but when I am trying to use revision number along with build it's throwing exception:
can not get revision from SCM repositoty ,No provider git
My pom.xml includes:
<scm>
<connection>scm:git:git://github.com/user/app.git</connection>
<developerConnection>scm:git:[email protected]:user/app.git</developerConnection>
<url>https://github.com/user/app.git</url>
</scm>
is there any plugin is needed because I have just included details and buildnumber plugin.
The maven-release-plugin can help you to build a new version of an artifact (and incrementing automatically the <version>
.
But, I'm not sure this what you need, because it's quite unusual to create a new release on every build.
So I suggest you the maven-buildnumber-plugin which allows you to append something like a build number (or a timestamp to the artifact name).