You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by "chandra.c49" <ch...@gmail.com> on 2011/02/18 06:48:55 UTC

how can we replace properties values in the element .

Hi , 

     I've a maven project in the following structure setup -- 

                                 Component1
                                                     --module1
                                                     --module2
                                                     --pom.xml
                                 Component2  -- > contains a <parent>
element referring to <Component1>
                                 Component3  --> contains a <parent> element
referring to <Component1>
                                 Component4 --> profiles.xml 

  and each team develops it's own component , hence they have a PROFILE
setup in their settings.xml file . This profile contians some properties
<path values ,versions etc..>  used by the AD team locally . 

few questions --

1) Can Component4 profiles.xml properties be used across other components
also. ? 
2) The settings.xml file contains a profile with few properties set , and
this overrides all the other properties from all the components. But, it
does NOT for the <parent> element .  how do we achieve this .? 

  for ex : Component2 contains a <parent> element referring to to
<Component1> 

               Component2 pom.xml file is below , with <relativePath>
element .
            ----------------------------------------
                    <parent> 
                              <groupid>com.xyz.components</groupid>
                               <artifactId>component1</artifactid>
                              
<relativePath>../${Comp1.Path}/pom.xml</relativePath>
                      </parent>
                    ----------

As I try to execute from the Component2 , it first tries to scan the pom
file and fails as it can't find the Component1 pom file , due to not able to
refer to the ${comp1.Path}  property value from "settings.xml" file . 

How can we achieve this, with out hardcoding the <relativePath> element
vlaue . Please let me know any other ways .


Thanks,
Chandra
                             
                 
-- 
View this message in context: http://maven.40175.n5.nabble.com/how-can-we-replace-properties-values-in-the-parent-element-tp3390613p3390613.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: how can we replace properties values in the element .

Posted by Wendy Smoak <ws...@gmail.com>.
On Tue, Feb 22, 2011 at 3:11 AM, chandra.c49 <ch...@gmail.com> wrote:
>     And, if we build the parent and then the component without
> <relativePath> , it builds fine.But,not everytime we build from the
> component , and as the parent project name changes and is maintianed in the
> settings.xml profile; hence it requires a way where the <relativePath> can
> be dynamically loaded from settings.xml profiles.

At the risk of sounding like a three-year-old... "But, WHY?"

Why do you need to switch parents every time you build?

This is not a standard/conventional Maven project structure.

Most likely you need to consolidate the stuff in the 'different'
parents into a single pom, possibly controlled by profiles.  But until
we hear why you're trying to do it in the first place, that's just a
guess.

-- 
Wendy

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


Re: how can we replace properties values in the element .

Posted by "chandra.c49" <ch...@gmail.com>.
Hi Wendy , 

     I agree to the concern why is the <parent> being used in different
components. But, the project < which contains multiple components > is being
setup this way and each component refers to the <parent> [ actually as these
components uses the <parent> component dependencies ,it is setup this way] . 

     And, if we build the parent and then the component without
<relativePath> , it builds fine.But,not everytime we build from the
component , and as the parent project name changes and is maintianed in the
settings.xml profile; hence it requires a way where the <relativePath> can
be dynamically loaded from settings.xml profiles. 

Thanks,
Chandra
-- 
View this message in context: http://maven.40175.n5.nabble.com/how-can-we-replace-properties-values-in-the-parent-element-tp3390613p3395180.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: how can we replace properties values in the element .

Posted by Wendy Smoak <ws...@gmail.com>.
On Fri, Feb 18, 2011 at 1:39 PM, chandra.c49 <ch...@gmail.com> wrote:
>  My question was  -- The build fails to run if we run a maven Component
> build with below <parent> element in place. The below <parent> element uses
> the <relativePath> element to refer ,  as it is located at different
> location with name customized . So, how can we pass this ${Comp1.Path} value
> at runtime .

That's still not the right question.  Why do you think you need to do
this?  What underlying problem are you trying to solve by using (I
assume) different parents for different builds?

If you go to the location of the parent and do "mvn install" then
remove the <relativePath> in your project pom and try to build that,
what happens?

-- 
Wendy

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


Re: how can we replace properties values in the element .

Posted by "chandra.c49" <ch...@gmail.com>.
Sorry the question was not about <parent> element supporting versionless .
But was good to know , about this . 

 My question was  -- The build fails to run if we run a maven Component
build with below <parent> element in place. The below <parent> element uses
the <relativePath> element to refer ,  as it is located at different
location with name customized . So, how can we pass this ${Comp1.Path} value
at runtime . 
--> pass the proeprty value from cmd line and it fails .< mvn clean install
-DComp1.path=xxxx > 
--> pass from settings.xml , profile setting this property value , it will
not pick up and execution fails.  

                    <parent>
                              <groupid>com.xyz.components</groupid>
                               <artifactId>component1</artifactid>
                               <version>5.0</verison>
                              
<relativePath>../${Comp1.Path}/pom.xml</relativePath>
                      </parent> 


pls advise .


Thanks,
Chandra Moahn .
-- 
View this message in context: http://maven.40175.n5.nabble.com/how-can-we-replace-properties-values-in-the-parent-element-tp3390613p3391541.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: how can we replace properties values in the element .

Posted by Ron Wheeler <rw...@artifact-software.com>.
Perhaps it might be helpful in giving a solution, if we had the root 
problem better described.

What are the particular properties of your application that makes it 
unlike anything that has ever been built with Maven?

Maven is incredibly flexible and the technical expertise in this forum 
is the best available.
However, just because you can make Maven do something (not the case this 
time), does not mean that you should.

What are you trying to build and why is this project structure the best 
way to do that?

Perhaps there is a simple way to get you a build structure that works well.

Ron


On 18/02/2011 2:21 AM, Anders Hammar wrote:
> Neither does Maven 3.0. Possibly future version of Maven will have this
> feature.
>
> /Anders
>
> On Fri, Feb 18, 2011 at 06:54, Anurag Kumar Nilesh<an...@yahoo-inc.com>wrote:
>
>> Maven 2 doesn't have support for versionless parent pom.
>>
>> You may use maven 3 instead
>> https://cwiki.apache.org/MAVEN/maven-3x.html
>>
>>
>> On 2/18/11 11:18 AM, "chandra.c49"<ch...@gmail.com>  wrote:
>>
>>
>>
>> Hi ,
>>
>>      I've a maven project in the following structure setup --
>>
>>                                  Component1
>>                                                      --module1
>>                                                      --module2
>>                                                      --pom.xml
>>                                  Component2  -->  contains a<parent>
>> element referring to<Component1>
>>                                  Component3  -->  contains a<parent>  element
>> referring to<Component1>
>>                                  Component4 -->  profiles.xml
>>
>>   and each team develops it's own component , hence they have a PROFILE
>> setup in their settings.xml file . This profile contians some properties
>> <path values ,versions etc..>   used by the AD team locally .
>>
>> few questions --
>>
>> 1) Can Component4 profiles.xml properties be used across other components
>> also. ?
>> 2) The settings.xml file contains a profile with few properties set , and
>> this overrides all the other properties from all the components. But, it
>> does NOT for the<parent>  element .  how do we achieve this .?
>>
>>   for ex : Component2 contains a<parent>  element referring to to
>> <Component1>
>>
>>                Component2 pom.xml file is below , with<relativePath>
>> element .
>>             ----------------------------------------
>>                     <parent>
>>                               <groupid>com.xyz.components</groupid>
>>                                <artifactId>component1</artifactid>
>>
>> <relativePath>../${Comp1.Path}/pom.xml</relativePath>
>>                       </parent>
>>                     ----------
>>
>> As I try to execute from the Component2 , it first tries to scan the pom
>> file and fails as it can't find the Component1 pom file , due to not able
>> to
>> refer to the ${comp1.Path}  property value from "settings.xml" file .
>>
>> How can we achieve this, with out hardcoding the<relativePath>  element
>> vlaue . Please let me know any other ways .
>>
>>
>> Thanks,
>> Chandra
>>
>>
>> --
>> View this message in context:
>> http://maven.40175.n5.nabble.com/how-can-we-replace-properties-values-in-the-parent-element-tp3390613p3390613.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: how can we replace properties values in the element .

Posted by Anders Hammar <an...@hammar.net>.
Neither does Maven 3.0. Possibly future version of Maven will have this
feature.

/Anders

On Fri, Feb 18, 2011 at 06:54, Anurag Kumar Nilesh <an...@yahoo-inc.com>wrote:

> Maven 2 doesn't have support for versionless parent pom.
>
> You may use maven 3 instead
> https://cwiki.apache.org/MAVEN/maven-3x.html
>
>
> On 2/18/11 11:18 AM, "chandra.c49" <ch...@gmail.com> wrote:
>
>
>
> Hi ,
>
>     I've a maven project in the following structure setup --
>
>                                 Component1
>                                                     --module1
>                                                     --module2
>                                                     --pom.xml
>                                 Component2  -- > contains a <parent>
> element referring to <Component1>
>                                 Component3  --> contains a <parent> element
> referring to <Component1>
>                                 Component4 --> profiles.xml
>
>  and each team develops it's own component , hence they have a PROFILE
> setup in their settings.xml file . This profile contians some properties
> <path values ,versions etc..>  used by the AD team locally .
>
> few questions --
>
> 1) Can Component4 profiles.xml properties be used across other components
> also. ?
> 2) The settings.xml file contains a profile with few properties set , and
> this overrides all the other properties from all the components. But, it
> does NOT for the <parent> element .  how do we achieve this .?
>
>  for ex : Component2 contains a <parent> element referring to to
> <Component1>
>
>               Component2 pom.xml file is below , with <relativePath>
> element .
>            ----------------------------------------
>                    <parent>
>                              <groupid>com.xyz.components</groupid>
>                               <artifactId>component1</artifactid>
>
> <relativePath>../${Comp1.Path}/pom.xml</relativePath>
>                      </parent>
>                    ----------
>
> As I try to execute from the Component2 , it first tries to scan the pom
> file and fails as it can't find the Component1 pom file , due to not able
> to
> refer to the ${comp1.Path}  property value from "settings.xml" file .
>
> How can we achieve this, with out hardcoding the <relativePath> element
> vlaue . Please let me know any other ways .
>
>
> Thanks,
> Chandra
>
>
> --
> View this message in context:
> http://maven.40175.n5.nabble.com/how-can-we-replace-properties-values-in-the-parent-element-tp3390613p3390613.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: how can we replace properties values in the element .

Posted by Anurag Kumar Nilesh <an...@yahoo-inc.com>.
Maven 2 doesn't have support for versionless parent pom.

You may use maven 3 instead
https://cwiki.apache.org/MAVEN/maven-3x.html


On 2/18/11 11:18 AM, "chandra.c49" <ch...@gmail.com> wrote:



Hi ,

     I've a maven project in the following structure setup --

                                 Component1
                                                     --module1
                                                     --module2
                                                     --pom.xml
                                 Component2  -- > contains a <parent>
element referring to <Component1>
                                 Component3  --> contains a <parent> element
referring to <Component1>
                                 Component4 --> profiles.xml

  and each team develops it's own component , hence they have a PROFILE
setup in their settings.xml file . This profile contians some properties
<path values ,versions etc..>  used by the AD team locally .

few questions --

1) Can Component4 profiles.xml properties be used across other components
also. ?
2) The settings.xml file contains a profile with few properties set , and
this overrides all the other properties from all the components. But, it
does NOT for the <parent> element .  how do we achieve this .?

  for ex : Component2 contains a <parent> element referring to to
<Component1>

               Component2 pom.xml file is below , with <relativePath>
element .
            ----------------------------------------
                    <parent>
                              <groupid>com.xyz.components</groupid>
                               <artifactId>component1</artifactid>

<relativePath>../${Comp1.Path}/pom.xml</relativePath>
                      </parent>
                    ----------

As I try to execute from the Component2 , it first tries to scan the pom
file and fails as it can't find the Component1 pom file , due to not able to
refer to the ${comp1.Path}  property value from "settings.xml" file .

How can we achieve this, with out hardcoding the <relativePath> element
vlaue . Please let me know any other ways .


Thanks,
Chandra


--
View this message in context: http://maven.40175.n5.nabble.com/how-can-we-replace-properties-values-in-the-parent-element-tp3390613p3390613.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