You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by mojavelinux <da...@mojavelinux.com> on 2007/06/14 02:10:31 UTC

Re: Overriding properties in a dependency's pom.xml

Damn, I just bumped in to this problem only to find that there is still no
solution.  I am trying to do a very similar thing.  When one of my libraries
depends on hibernate, for example, I am using properties in the deployed pom
file to specify which version should be used by default if a person where to
use my jar file in their project.  However, if they don't want that version
of hibernate, they theoretically would set the same property in their own
pom.xml file.  Only, just as Matt has pointed out, the dependency pom is
taking precedence over the user's pom.xml.  This behavior makes absolutely
no sense, especially since it is possible to achieve this override from the
commandline.  The perfectly logical order would be: dependency pom -> user
pom -> commandline flag.

Here is some XML to demonstrate what I am doing:

some-cool-library.pom

<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate</artifactId>
<version>${hibernate.version}</version>
</dependency>
<properties>
<hibernate.version>3.2.1.ga</hibernate.version>
</properties>

user's pom.xml

<properties>
<hibernate.version>3.2.4.sp1</hibernate.version>
</properties>

result: no dice.

/dan


mraible wrote:
> 
> Bump.
> 
> I'd really, really like the ability to override the property of a
> dependency in a project's pom.xml.  Can anyone answer if this is currently
> possible - for example using the <dependencyManagement> feature?  If it's
> not possible, is it possible to write a plugin to do this or is everything
> locked down in Maven's core?
> 
> This feature is essential to the AppFuse project if we want to allow
> multiple persistent frameworks for users.  Requiring folks to use a -D
> parameter (or modifying MAVEN_OPTS) is quite unmaintainable.
> 
> Thanks,
> 
> Matt
> 
> 
> mraible wrote:
>> 
>> I've entered an enhancement request for this at:
>> 
>> http://jira.codehaus.org/browse/MNG-2757
>> 
>> Maven Developers: how hard would it be to allow property overriding?  It
>> seems like a natural thing to want to do.
>> 
>> Thanks,
>> 
>> Matt
>> 
>> 
>> Larry Meadors-2 wrote:
>>> 
>>> On 1/4/07, mraible <ma...@raibledesigns.com> wrote:
>>>> Is Maven like Ant in that properties are immutable?  If so, can I hook
>>>> into
>>>> the lifecycle sooner and set this dao.framework property from the local
>>>> pom.xml?
>>> 
>>> I was thinking the same thing - it sure is acting like that is the case,
>>> no?
>>> 
>>> Larry
>>> 
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
>>> For additional commands, e-mail: users-help@maven.apache.org
>>> 
>>> 
>>> 
>> 
>> 
> 
> 

-- 
View this message in context: http://www.nabble.com/Overriding-properties-in-a-dependency%27s-pom.xml-tf2921218s177.html#a11111409
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