You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by RAJIV_S <ra...@gmail.com> on 2012/05/14 14:42:13 UTC

Reg. accessing parent POM's property in child POM's version tag

I have a project structure like the below

School-parent
	|
	|
	|---- services-parent
	|	|	|
	|	|	|-Services-core
	|	|		|
	|	|		|---pom.xml
	|	|
	|	|---pom.xml	
	|
	|----util-parent
	|	|
	|	|-common-util
	|	|	|
	|	|	|---pom.xml
	|	|
	|	|---pom.xml	
	|
	|---pom.xml
	
	
(1) school-parent's POM looks like below
	<modelVersion>4.0.0</modelVersion>
	<groupId>room</groupId>
	<artifactId>School-parent</artifactId>
	<version>0.0.1-SNAPSHOT</version>
	<packaging>pom</packaging>
	  <properties>
		<util-version>0.0.1-SNAPSHOT</util-version>
		<services-parent>0.0.1-SNAPSHOT</services-parent>
	  </properties>
	  <modules>
		 <module>services-parent</module> 
		  <module>util-parent</module>
	  </modules>
	  
(2) util-parent POM looks like 
	<modelVersion>4.0.0</modelVersion>
	<parent>
		<artifactId>School-parent</artifactId>
		<groupId>room</groupId>
		<version>0.0.1-SNAPSHOT</version>
		<relativePath>../</relativePath>
	</parent>
	<groupId>room</groupId>
	<artifactId>util-parent</artifactId>
	<packaging>pom</packaging>
	<version>${util-version}</version>	
	<modules>
		<module>common-util</module>
	</modules>
	
(3) common-util POM looks like	
	  <modelVersion>4.0.0</modelVersion>
	  <parent>
	    <artifactId>util-parent</artifactId>
	    <groupId>room</groupId>
		<version>${util-version}</version>	
	    <relativePath>../</relativePath>
	  </parent>
	  <groupId>room</groupId>
	  <artifactId>common-util</artifactId>
	</project>
(4) services - parent's POM looks like	
	<modelVersion>4.0.0</modelVersion>
	  <parent>
	    <artifactId>School-parent</artifactId>
	    <groupId>room</groupId>
	    <version>0.0.1-SNAPSHOT</version>
	    <relativePath>../</relativePath>
	  </parent>
	  <groupId>room</groupId>
	  <artifactId>services-parent</artifactId>
	  <packaging>pom</packaging>
	  <version>${services-parent}</version>
	  <modules>
		<module>services-core</module>
	  </modules>
	
(5) services-core's POM looks like	
	<parent>
		<artifactId>services-parent</artifactId>
		<groupId>room</groupId>
		<version>${services-parent}</version>
		<relativePath>../</relativePath>
	</parent>
	<groupId>room</groupId>
	<artifactId>services-core</artifactId>
	<dependencies>
		<dependency>
			<groupId>room</groupId>
			<artifactId>common-util</artifactId>
			<version>${util-version}</version>			
		</dependency>
	</dependencies>

	
	
While running the root POM(No. 1), build success.
But while running services parent individually , I am getting an build error
saying it is not able to find common-util.

Is the way i am accessing property value(${...}), inside version tag having
any issue ?
Or 
Any other issue ?

Please help me to solve this issue, or give some suggestion on how can i
overcome this problem.. ?


--
View this message in context: http://maven.40175.n5.nabble.com/Reg-accessing-parent-POM-s-property-in-child-POM-s-version-tag-tp5708657.html
Sent from the Maven - Users mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: Reg. accessing parent POM's property in child POM's version tag

Posted by Stephen Connolly <st...@gmail.com>.
On 14 May 2012 14:26, RAJIV_S <ra...@gmail.com> wrote:
> <version>${project.version}</version>

That is not a property but a reference to the pom.

>
> I thought based on the above example, any property value should be supported
> in version tag using ${...}

not in /project/version or /project/parent/version

>
>
> Any, recommendtion/solution for my problem ,.. how can solve this issue ?
> Plz explain a bit detail as i am new this maven..
>
>
> Means , Nowhere i can't use dynamic values(custom decalred properrties) from
> parent POM for *version tag* isn't ?

not quite true, but keep in mind that the release plugin will update
the hardcoded versions for you

>
>
>
> --
> View this message in context: http://maven.40175.n5.nabble.com/Reg-accessing-parent-POM-s-property-in-child-POM-s-version-tag-tp5708657p5708662.html
> Sent from the Maven - Users mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: Reg. accessing parent POM's property in child POM's version tag

Posted by RAJIV_S <ra...@gmail.com>.
<version>${project.version}</version> 

I thought based on the above example, any property value should be supported
in version tag using ${...}


Any, recommendtion/solution for my problem ,.. how can solve this issue ? 
Plz explain a bit detail as i am new this maven.. 


Means , Nowhere i can't use dynamic values(custom decalred properrties) from
parent POM for *version tag* isn't ? 



--
View this message in context: http://maven.40175.n5.nabble.com/Reg-accessing-parent-POM-s-property-in-child-POM-s-version-tag-tp5708657p5708662.html
Sent from the Maven - Users mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: Reg. accessing parent POM's property in child POM's version tag

Posted by Stephen Connolly <st...@gmail.com>.
Properties are not supported in the following XPath elements:

/project(/parent)?/(groupId/artifactId/version)

-Stephen

On 14 May 2012 13:42, RAJIV_S <ra...@gmail.com> wrote:
> I have a project structure like the below
>
> School-parent
>        |
>        |
>        |---- services-parent
>        |       |       |
>        |       |       |-Services-core
>        |       |               |
>        |       |               |---pom.xml
>        |       |
>        |       |---pom.xml
>        |
>        |----util-parent
>        |       |
>        |       |-common-util
>        |       |       |
>        |       |       |---pom.xml
>        |       |
>        |       |---pom.xml
>        |
>        |---pom.xml
>
>
> (1) school-parent's POM looks like below
>        <modelVersion>4.0.0</modelVersion>
>        <groupId>room</groupId>
>        <artifactId>School-parent</artifactId>
>        <version>0.0.1-SNAPSHOT</version>
>        <packaging>pom</packaging>
>          <properties>
>                <util-version>0.0.1-SNAPSHOT</util-version>
>                <services-parent>0.0.1-SNAPSHOT</services-parent>
>          </properties>
>          <modules>
>                 <module>services-parent</module>
>                  <module>util-parent</module>
>          </modules>
>
> (2) util-parent POM looks like
>        <modelVersion>4.0.0</modelVersion>
>        <parent>
>                <artifactId>School-parent</artifactId>
>                <groupId>room</groupId>
>                <version>0.0.1-SNAPSHOT</version>
>                <relativePath>../</relativePath>
>        </parent>
>        <groupId>room</groupId>
>        <artifactId>util-parent</artifactId>
>        <packaging>pom</packaging>
>        <version>${util-version}</version>
>        <modules>
>                <module>common-util</module>
>        </modules>
>
> (3) common-util POM looks like
>          <modelVersion>4.0.0</modelVersion>
>          <parent>
>            <artifactId>util-parent</artifactId>
>            <groupId>room</groupId>
>                <version>${util-version}</version>
>            <relativePath>../</relativePath>
>          </parent>
>          <groupId>room</groupId>
>          <artifactId>common-util</artifactId>
>        </project>
> (4) services - parent's POM looks like
>        <modelVersion>4.0.0</modelVersion>
>          <parent>
>            <artifactId>School-parent</artifactId>
>            <groupId>room</groupId>
>            <version>0.0.1-SNAPSHOT</version>
>            <relativePath>../</relativePath>
>          </parent>
>          <groupId>room</groupId>
>          <artifactId>services-parent</artifactId>
>          <packaging>pom</packaging>
>          <version>${services-parent}</version>
>          <modules>
>                <module>services-core</module>
>          </modules>
>
> (5) services-core's POM looks like
>        <parent>
>                <artifactId>services-parent</artifactId>
>                <groupId>room</groupId>
>                <version>${services-parent}</version>
>                <relativePath>../</relativePath>
>        </parent>
>        <groupId>room</groupId>
>        <artifactId>services-core</artifactId>
>        <dependencies>
>                <dependency>
>                        <groupId>room</groupId>
>                        <artifactId>common-util</artifactId>
>                        <version>${util-version}</version>
>                </dependency>
>        </dependencies>
>
>
>
> While running the root POM(No. 1), build success.
> But while running services parent individually , I am getting an build error
> saying it is not able to find common-util.
>
> Is the way i am accessing property value(${...}), inside version tag having
> any issue ?
> Or
> Any other issue ?
>
> Please help me to solve this issue, or give some suggestion on how can i
> overcome this problem.. ?
>
>
> --
> View this message in context: http://maven.40175.n5.nabble.com/Reg-accessing-parent-POM-s-property-in-child-POM-s-version-tag-tp5708657.html
> Sent from the Maven - Users mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: Reg. accessing parent POM's property in child POM's version tag

Posted by Anders Hammar <an...@hammar.net>.
What are you trying to accomplish? If you don't declare the version
element in a Maven project, Maven will use the version of the declared
parent as the version.
So, my suggestions is to have the versions hard-coded in the parent
section. The release plugin will update these when you release a
project, so you don't have to manage them manually.

/Anders

On Mon, May 14, 2012 at 2:42 PM, RAJIV_S <ra...@gmail.com> wrote:
> I have a project structure like the below
>
> School-parent
>        |
>        |
>        |---- services-parent
>        |       |       |
>        |       |       |-Services-core
>        |       |               |
>        |       |               |---pom.xml
>        |       |
>        |       |---pom.xml
>        |
>        |----util-parent
>        |       |
>        |       |-common-util
>        |       |       |
>        |       |       |---pom.xml
>        |       |
>        |       |---pom.xml
>        |
>        |---pom.xml
>
>
> (1) school-parent's POM looks like below
>        <modelVersion>4.0.0</modelVersion>
>        <groupId>room</groupId>
>        <artifactId>School-parent</artifactId>
>        <version>0.0.1-SNAPSHOT</version>
>        <packaging>pom</packaging>
>          <properties>
>                <util-version>0.0.1-SNAPSHOT</util-version>
>                <services-parent>0.0.1-SNAPSHOT</services-parent>
>          </properties>
>          <modules>
>                 <module>services-parent</module>
>                  <module>util-parent</module>
>          </modules>
>
> (2) util-parent POM looks like
>        <modelVersion>4.0.0</modelVersion>
>        <parent>
>                <artifactId>School-parent</artifactId>
>                <groupId>room</groupId>
>                <version>0.0.1-SNAPSHOT</version>
>                <relativePath>../</relativePath>
>        </parent>
>        <groupId>room</groupId>
>        <artifactId>util-parent</artifactId>
>        <packaging>pom</packaging>
>        <version>${util-version}</version>
>        <modules>
>                <module>common-util</module>
>        </modules>
>
> (3) common-util POM looks like
>          <modelVersion>4.0.0</modelVersion>
>          <parent>
>            <artifactId>util-parent</artifactId>
>            <groupId>room</groupId>
>                <version>${util-version}</version>
>            <relativePath>../</relativePath>
>          </parent>
>          <groupId>room</groupId>
>          <artifactId>common-util</artifactId>
>        </project>
> (4) services - parent's POM looks like
>        <modelVersion>4.0.0</modelVersion>
>          <parent>
>            <artifactId>School-parent</artifactId>
>            <groupId>room</groupId>
>            <version>0.0.1-SNAPSHOT</version>
>            <relativePath>../</relativePath>
>          </parent>
>          <groupId>room</groupId>
>          <artifactId>services-parent</artifactId>
>          <packaging>pom</packaging>
>          <version>${services-parent}</version>
>          <modules>
>                <module>services-core</module>
>          </modules>
>
> (5) services-core's POM looks like
>        <parent>
>                <artifactId>services-parent</artifactId>
>                <groupId>room</groupId>
>                <version>${services-parent}</version>
>                <relativePath>../</relativePath>
>        </parent>
>        <groupId>room</groupId>
>        <artifactId>services-core</artifactId>
>        <dependencies>
>                <dependency>
>                        <groupId>room</groupId>
>                        <artifactId>common-util</artifactId>
>                        <version>${util-version}</version>
>                </dependency>
>        </dependencies>
>
>
>
> While running the root POM(No. 1), build success.
> But while running services parent individually , I am getting an build error
> saying it is not able to find common-util.
>
> Is the way i am accessing property value(${...}), inside version tag having
> any issue ?
> Or
> Any other issue ?
>
> Please help me to solve this issue, or give some suggestion on how can i
> overcome this problem.. ?
>
>
> --
> View this message in context: http://maven.40175.n5.nabble.com/Reg-accessing-parent-POM-s-property-in-child-POM-s-version-tag-tp5708657.html
> Sent from the Maven - Users mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org