views:

44

answers:

2

We currently use SNAPSHOT modifier in development so that project dependencies are linked to the most current build of its dependencies. So when we build a project we get all the jars with various time SNAPSHOTS. Regardless of a code change.

This proves to be an issue when the end user wants to download a new release. For example there is a big jar file that is rarely updated. We would like for that particular jar file to be referred to as it version number 1.4 as supposed to 1.4-SNAPSHOT when we release it to the customer meaning they only download new version when we make changes to the version number as supposed to when we last built it with or without changes.

What is the best way to achieve this? Am I missing something?

Please and thank you.

+1  A: 

This proves to be an issue when the end user wants to download a new release.

First of all, releases should indeed use fixed versions. So if you're developing version 1.4-SNAPSHOT, the release version is supposed to be 1.4 (and you tag it as such in your VCS). And then you bump the new development version to 1.5-SNAPSHOT in the dev branch.

For example there is a big jar file that is rarely updated. We would like for that particular jar file to be referred to as it version number 1.4 (...)

But even if you follow the above "standard" process, nothing forces you to bump all versions after a release and you could just stick to a given fixed version of a particular artifact. This would remove the problem.

Pascal Thivent
okay a better example maybe; that there are many jars sometimes all are not changed between releases; I would like customer to only download changes that are new as supposed when they are built.
garbagecollector
good stuff! Thanks!
garbagecollector
is there a way to automate this. currently we have -SNAPSHOT attached to every one of our packages, how can i make it so when we do a release the SNAPSHOT is ignored. so the development copies can continue? or is it that i need a new branch and remove -SNAPSHOT from that branch, and develop there as a release, how do we overcome the issue of maven only downloading version 1.4 only once since its missing the SNAPSHOT appendage.
garbagecollector
@garbagecollector I'm sorry. I didn't understand :S
Pascal Thivent
okay all my poms currently have -SNAPSHOT, which causes the issue i am complaining about in my question. is there a maven life cycle that removes -snapshot automatically? so that i dont have to separate my builds into with -snapshot and without -snapshot? so when i release to customer they only download the updated jar files. :) is that better?
garbagecollector
@garbagecollector A bit :) Whether you automate the process or not, you should release fixed version artifacts to your customer. If you want to fully automate the process, you can use the [maven release plugin](http://maven.apache.org/plugins/maven-release-plugin/). If you just want some support to update the version in your poms, have a look at the [maven versions plugin](http://mojo.codehaus.org/versions-maven-plugin/). I'm not sure if this does answer the question though.
Pascal Thivent
@Pascal I will look into those. i want to release fixed number releases to my customer but all my POMs contain -SNAPSHOT. is there a plugin or life cycle that removes -SNAPSHOT from the POM when i am releasing to a customer or do I need to maintain two separate sets of POM files. What is the best practice for solving this issue. I hope i was articulate enough this time. Thanks for your patience and help pascal.
garbagecollector
@garbagecollector As I wrote in a comment above (and in another question), the maven release plugin can do that. Another option is the maven versions plugin. You certainly don't need two separate sets of POM files. Have a look at them.
Pascal Thivent
@Pascal I did have a look that answered my question. I appreciate it!
garbagecollector
A: 

In my opinion a way to a user is a kind of delivery and should be handled by using the maven release process (mvn release) which automatically increments the version numbers. Than you have an exact relationship to your version control and what user has got. SNAPSHOT's should only be used in development.

khmarbaise
does maven release get rid of the -SNAPSHOT tack? what type of jar is produced? 1.4.jar or 1.4-SNAPSHOT?
garbagecollector
Have a look at the Codehaus 'versions' plugin (http://mojo.codehaus.org/versions-maven-plugin/) - it allows you to do lots of things like that.
Cornel Masson