Hi!

I tried the release plugin a few months ago and couldn't get it to work for
such a complex setup. If I remember correctly, when I did the
release:prepare stage with -DdryRun=true it worked fine, but when I did it
for real I got some exception... But still, even if I got that to work, I
would still have to manually replace all snapshot dependency versions that
was not part of the current project. Maybe I'll find the time to experiment
a bit today to find out what the error was...

And Yan, I tried your idea to put the properties in settings.xml (via a
profile), but that didn't work either.

/Anders,


> ----- Message from "Huang, Yan" <[EMAIL PROTECTED]> on Wed, 12
> Sep 2007 12:10:16 -0700 -----
>
> To:
>
> "Maven Users List" <[email protected]>
>
> Subject:
>
> RE: Parametrisizing artifact version numbers
>
> It always puzzles me that maven does not resolve the property when
> building in the individual module vs. it's able to do so when building
> from the parent level. The property is defined in the "settings.xml",
> should maven pick up and resolve it when building from inside of
> individual modules?
>
> -----Original Message-----
> From: Wayne Fay [mailto:[EMAIL PROTECTED]
> Sent: Wednesday, September 12, 2007 8:59 AM
> To: Maven Users List
> Subject: Re: Parametrisizing artifact version numbers
>
> Have you considered the release plugin?
>
> Wayne
>
> On 9/12/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
> >
> > Hi!
> > I'm working on a few different maven projects with several modules in
> each.
> > Most of the modules have dependencies to other modules within the same
> > project and also to other projects. Since the development in most of
> these
> > projects go in parallell, most of the dependencies are towards
> snapshot
> > versions.
> >
> > Now, my problem is that when I want to make a release, I have to go
> through
> > 30+ poms and replace snapshot versions with the new versions, check in
> the
> > new poms, tag, and then I have to replace the versions to new snapshot
> > versions... A lot of work, and it's easy to make a mistake.
> >
> > So, I'm trying to put the version numbers in properties instead, so I
> only
> > have to update the properties of the parent pom in each project.
> >
> > Here's a few sample poms of two projects, where "myotherproject"
> depends on
> > "myproject":
> >
> > <!-- parent pom for myproject -->
> > <project xmlns="http://maven.apache.org/POM/4.0.0";
> > xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
> > xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
> > http://maven.apache.org/maven-v4_0_0.xsd";>
> >       <modelVersion>4.0.0</modelVersion>.
> >       <groupId>my.project</groupId>
> >       <version>${my.project.version}</version>
> >       <artifactId>myparentpom</artifactId>
> >       <packaging>pom</packaging>
> >       <modules>
> >             <module>myjar</module>
> >       </modules>
> >       <properties>
> >             <my.project.version>1.2-SNAPSHOT</my.project.version>
> >       </properties>
> > </project>
> >
> > <!-- jar module pom for myproject -->
> > <project xmlns="http://maven.apache.org/POM/4.0.0";
> > xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
> > xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
> > http://maven.apache.org/maven-v4_0_0.xsd";>
> >       <modelVersion>4.0.0</modelVersion>.
> >       <groupId>my.project</groupId>
> >       <version>${my.project.version}</version>
> >       <artifactId>myjar</artifactId>
> >       <packaging>jar</packaging>
> >       <parent>
> >             <groupId>my.project</groupId>
> >             <artifactId>myparentpom</artifactId>
> >             <version>${my.project.version}</version>
> >       </parent>>
> > </project>>
> >
> > <!-- parent pom for myotherproject -->
> > <project xmlns="http://maven.apache.org/POM/4.0.0";
> > xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
> > xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
> > http://maven.apache.org/maven-v4_0_0.xsd";>
> >       <modelVersion>4.0.0</modelVersion>.
> >       <groupId>my.other.project</groupId>
> >       <version>${my.other.project.version}</version>.
> >       <artifactId>myotherparentpom</artifactId>
> >       <packaging>pom</packaging>
> >       <modules>
> >             <module>myotherjar</module>
> >       </modules>
> >       <properties>
> >             <my.project.version>1.2-SNAPSHOT</my.project.version>
> >
> > <my.other.project.version>1.1-SNAPSHOT</my.other.project.version>
> >       </properties>
> > </project>
> >
> > <!-- jar module pom for myotherproject -->
> > <project xmlns="http://maven.apache.org/POM/4.0.0";
> > xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
> > xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
> > http://maven.apache.org/maven-v4_0_0.xsd";>
> >       <modelVersion>4.0.0</modelVersion>.
> >       <groupId>my.other.project</groupId>
> >       <version>${my.other.project.version}</version>.
> >       <artifactId>myotherjar</artifactId>}
> >       <packaging>jar</packaging>
> >       <parent>
> >             <groupId>my.other.project</groupId>
> >             <artifactId>myotherparentpom</artifactId>
> >             <version>${my.other.project.version}</version>
> >       </parent>>
> >       <dependencies>.
> >             <dependency>>.
> >                   <groupId>my.project</groupId>
> >                   <artifactId>myjar</artifactId>
> >                   <version>${my.project.version}</version>
> >             </dependency>
> >       </dependencies>.
> > </project>
> >
> >
> > Now, I can succesfully build myproject, but when I build
> myotherproject I
> > get this error:
> >
> > [INFO]
> >
> ------------------------------------------------------------------------
> > [ERROR] BUILD ERROR
> > [INFO]
> >
> ------------------------------------------------------------------------
> > [INFO] Failed to resolve artifact.
> >
> > GroupId: my.project
> > ArtifactId: myparentpom
> > Version: ${my.project.version}
> >
> > Reason: Unable to download the artifact from any repository
> >
> >   my.project:myparentpom:pom:${my.project.version}
> >
> > from the specified remote repositories:
> >   central (http://repo1.maven.org/maven2).
> >
> >
> > When I look into my local repository I can see that the files and
> > directories of myproject correctly has the 1.2-SNAPSHOT version. But
> when I
> > look inside the saved poms in the repo I can see that they still
> contain
> > the ${my.project.version} variable, and it seems that maven is unable
> to
> > dereference that variable when resolving the dependency.
> >
> > So, am I missing something here? Do you have any other suggestions on
> how
> > to parametrisize the version numbers?
> >
> > Thanx in advance,
> > /Anders


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to