version-maven-plugin assumes that if you don't provide /project/version and instead rely on /project/parent/version being the default value then *the child must always have the same version as the parent*.
If the child may have a different version, then you specify the version. This behaves similarly with update-parent. if you specify a /project/version then, even if it is the same as /project/parent/version it will not be updated, but if you don't specify a /project/version then it will get updated. On 15 February 2013 15:37, Lewis, Eric <[email protected]> wrote: > Hi > > I'm using the versions-maven-plugin during our semi-automated release > process to set a version. > > However, I have a problem whenever the version of the project is the same > as the one in the parent. > Maven 3 shows a warning if the versions are the same, but if I remove the > version (which seems reasonable), I get an error from the versions plugin: > > Failed to execute goal org.codehaus.mojo:versions-maven-plugin:1.3.1:set > (default-cli) on project external-versions: Project version is inherited > from parent. > > > Here's the POM I'm trying to modify: > <parent> > <groupId>whatever</groupId> > <artifactId>my-parent</artifactId> > <version>1.13.0-SNAPSHOT</version> > <relativePath /> > </parent> > > <modelVersion>4.0.0</modelVersion> > <packaging>pom</packaging> > <artifactId>external-versions</artifactId> > ... > > And I try to modify it with > mvn org.codehaus.mojo:versions-maven-plugin:1.3.1:set > -DnewVersion=1.13.0-SNAPSHOT > > > > If I create an identical version with > <parent> > <groupId>whatever</groupId> > <artifactId>my-parent</artifactId> > <version>1.13.0-SNAPSHOT</version> > <relativePath /> > </parent> > > <modelVersion>4.0.0</modelVersion> > <packaging>pom</packaging> > <version>1.13.0-SNAPSHOT</version> > <artifactId>external-versions</artifactId> > > then it works. > > > > What am I doing wrong? > > (Yes, what I'm trying to do seems stupid, but I don't want to change the > command depending on whether the child inherits the version from its parent > or not - besides I don't know how I would find out whether it has its own > version or not. Also, sometimes the version is inherited from the parent > and sometimes not.) > > Best regards, > Eric > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [email protected] > For additional commands, e-mail: [email protected] > >
