• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Maven project's Version

 
junchen liu
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello!

at moment we put project version like this:

<modelVersion>4.0.0</modelVersion>
<groupId>xxx</groupId>
<artifactId>myProject</artifactId>
<packaging>jar</packaging>
<version>5.0.1</version>
<name>projectxxx</name>

and this number changes after each release(6.1 7.1 etc....)

problem is other projects referencing it as a dependency

need to change the version number 2.


with 30 different projects, this kind of work is tedious.


is there anyway, I can tell maven to build my project based on whatever is

in the CVS head, without referencing its version number?


many thanks!

 
Tim Holloway
Saloon Keeper
Pie
Posts: 18226
53
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Actually, one of the points behind Maven is that it provides a guaranteed product out of the buiild. So properly, each of those 30 projects should be tested and certified as functioning properly with the new product before updating the POM permanently. And that's a lot more work than just the simple text edit.

Obviously this doesn't work very well for new project development where all modules are in flux and there's not yet a production environment to screw up. For that, you can set up the POM dependency to use the latest version in the repository.

Another option is to do what I do for systems like Spring where there are a whole lot of dependencies for the different optional components where I want them all of the same version. For that, I use a variable substitution in the dependency version info.
 
junchen liu
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Tim Holloway wrote:

Agreed !
Actually, one of the points behind Maven is that it provides a guaranteed product out of the buiild. So properly, each of those 30 projects should be tested and certified as functioning properly with the new product before updating the POM permanently. And that's a lot more work than just the simple text edit.

The is my case ! but how?
Obviously this doesn't work very well for new project development where all modules are in flux and there's not yet a production environment to screw up. For that, you can set up the POM dependency to use the latest version in the repository.

A interesting option, most elegant one I would say, but how?
Another option is to do what I do for systems like Spring where there are a whole lot of dependencies for the different optional components where I want them all of the same version. For that, I use a variable substitution in the dependency version info.


many thanks!
 
Joachim Rohde
Ranch Hand
Posts: 433
Netbeans IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Tim Holloway wrote:Actually, one of the points behind Maven is that it provides a guaranteed product out of the buiild.

But that is only true if you but the version number in square brackets. Else it's only a suggestion and Maven may pick also another version of your dependendy if necessary! (See also the link that Peter posted).
 
Tim Holloway
Saloon Keeper
Pie
Posts: 18226
53
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Joachim Rohde wrote:
Tim Holloway wrote:Actually, one of the points behind Maven is that it provides a guaranteed product out of the buiild.

But that is only true if you but the version number in square brackets. Else it's only a suggestion and Maven may pick also another version of your dependendy if necessary! (See also the link that Peter posted).


Well, that was educational. I really hadn't explored all the nuances, although I do periodically have to weed through projects that have transitive requirement that conflict.

An explicit version number may only be a suggestion, but it's a very powerful suggestion, The Maven version resolution mechanism is going to try very hard to appease it.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic