"Once you've done that, you can leave off the child <version/> elements, and the parent's version will be used." I'll add that it's common to inherit the group too.
-----Original Message----- From: John Casey [mailto:[EMAIL PROTECTED] Sent: Tuesday, January 10, 2006 11:56 PM To: Maven Users List Subject: Re: [m2] Using variables from parent pom.xml - like version etc. There are two requirements for versioning in this case: 1. The parent POM has to have a valid <version/> element (no expressions here). 2. Each child POM must specify a <parent/> element that refers to the parent POM explicitly, including the version declared in the parent POM (again, no expressions here). Once you've done that, you can leave off the child <version/> elements, and the parent's version will be used. HTH, John Sanjay Choudhary wrote: > Thanks for taking time to reply. > > Let me ask my question in different way > > Parent Project currentversion 4.0 > > project 1 - extends parent project > project 2 - extends parent project > project 3 - extends parent project and depends on project 1 and > project 2 .. > .. > project 35 - extends parent project > > > Parent project + project1..35 make an Application. > > Life cycle of the parent project + child project's is same as application. > Let us say current version of the application 4.0. > > In maven 1.0.2 , we used to define tag <currentVersion> > 4.0</currentVersion>in parent project.xml Then in child projects, for > example child project 3, that is dependendent on project 1 and project > 2, We define dependency as > > <artifactId>project1</artifactId> > <version>${pom.currentVersion}</version> > > <artifactId>project2</artifactId> > <version>${pom.currentVersion}</version> > > Now if we hv. to release version 4.1 then all we need to do is change > the parent project.xml - currentVersion attribute. We don't need to > change all the 35 projects for the version. > > My question is how can a similar behavior achieved in M2. > > Thanks, > Sanjay > > > > > > > > > > On 1/10/06, Napoleon Esmundo Ramirez <[EMAIL PROTECTED]> wrote: >> Hello, >> >> I just checked your pom's. Your parent pom seems to be okay. But I >> think your second pom isn't. When declaring parent projects in child >> projects >> (modules) you should explicitly define the version. Try setting it >> with 1.0-8, and let's see what happens. >> >> I hope it works this time. :) >> >> Cheers! >> Nap >> >> On 1/11/06, Allan Ramirez <[EMAIL PROTECTED]> wrote: >>> Hi there, >>> >>> Try to use the <dependencyManangement> element. >>> >>> >>> >> http://maven.apache.org/guides/introduction/introduction-to-dependenc >> y-mechanism.html >>> Regards, >>> -allan >>> >>> Sanjay Choudhary wrote: >>> >>>> I tried using ${project.version} but got the following error >>>> >>>> >>>> [INFO] Trace >>>> org.apache.maven.reactor.MavenExecutionException: POM ' >>>> org.emember:org_kp_eme >>>> mber' not found in repository: >>>> >>>> org.kp.emember:org_kp_emember:pom:${project.version} >>>> >>>> >>>> >>>>> <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> >>>>> <parent> >>>>> <groupId>org.emember</groupId> >>>>> <artifactId>org_emember</artifactId> >>>>> <version>CAN I USE VERSION VARIABLE FROM POM? </version> >>>>> </parent> >>>>> >>>>> >>>> >>>> >>>> On 1/10/06, Napoleon Esmundo Ramirez <[EMAIL PROTECTED]> wrote: >>>> >>>> >>>>> Hello, >>>>> >>>>> Please try ${project.version}. >>>>> >>>>> Cheers! >>>>> Nap >>>>> >>>>> On 1/11/06, Sanjay Choudhary <[EMAIL PROTECTED]> wrote: >>>>> >>>>> >>>>>> I have parent pom.xml as below >>>>>> >>>>>> <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>org.emember</groupId> >>>>>> <artifactId>org_emember</artifactId> >>>>>> <packaging>pom</packaging> >>>>>> <version>1.0-8</version> >>>>>> <name>Maven Quick Start Archetype</name> >>>>>> <url>http://maven.apache.org</url> >>>>>> <dependencies> >>>>>> </dependencies> >>>>>> </project> >>>>>> >>>>>> >>>>>> Then I have pom.xml for each module <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> >>>>>> <parent> >>>>>> <groupId>org.emember</groupId> >>>>>> <artifactId>org_emember</artifactId> >>>>>> <version>CAN I USE VERSION VARIABLE FROM POM? </version> >>>>>> </parent> >>>>>> <groupId>org.kp.emember</groupId> >>>>>> <artifactId>kporgcommon</artifactId> >>>>>> <packaging>jar</packaging> >>>>>> <version>CAN I USE VERSION VARIABLE FROM POM? </version> >>>>>> >>>>>> in maven 1.0.2 we were able to use ${pom.currentVersion} but in >>>>>> maven >>>>>> >>>>>> >>>>> 2.0. >>>>> >>>>> >>>>>> ${pom.version} doesn't work. In my build I don't want to update >>>>>> 35 pom.xmls. >>>>>> With maven 1.0.2, our scripts update parent pom and that was >> available >>>>>> >>>>> in >>>>> >>>>> >>>>>> all the child projects. Please advice how we can use the >>>>>> variable >> from >>>>>> parent POM in M2 or if there is a alternate solution. >>>>>> >>>>>> -Sanjay >>>>>> >>>>>> >>>>>> >>>>>> >>>>> >>>> >>>> >>> -------------------------------------------------------------------- >>> ---- >>>> No virus found in this incoming message. >>>> Checked by AVG Free Edition. >>>> Version: 7.1.371 / Virus Database: 267.14.17/226 - Release Date: >>> 1/10/2006 >>>> >>> >>> >>> -------------------------------------------------------------------- >>> - To unsubscribe, e-mail: [EMAIL PROTECTED] >>> For additional commands, e-mail: [EMAIL PROTECTED] >>> >>> >> > --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
