RE: Overriding properties in a dependency's pom.xml
Hi Dan, mojavelinux wrote on Thursday, June 14, 2007 2:11 AM: 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 groupIdorg.hibernate/groupId artifactIdhibernate/artifactId version${hibernate.version}/version /dependency properties hibernate.version3.2.1.ga/hibernate.version /properties user's pom.xml properties hibernate.version3.2.4.sp1/hibernate.version /properties result: no dice. Don't use a property! Your users can overwrite the Hibernate version with an own dependencyManagement section easily. - Jörg - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
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 groupIdorg.hibernate/groupId artifactIdhibernate/artifactId version${hibernate.version}/version /dependency properties hibernate.version3.2.1.ga/hibernate.version /properties user's pom.xml properties hibernate.version3.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 [EMAIL PROTECTED] 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: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- View this message in context: http://www.nabble.com/Overriding-properties-in-a-dependency%27s-pom.xml-tf2921218s177.html#a1409 Sent from the Maven - Users mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Overriding properties in a dependency's pom.xml
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 [EMAIL PROTECTED] 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: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- View this message in context: http://www.nabble.com/Overriding-properties-in-a-dependency%27s-pom.xml-tf2921218s177.html#a9484182 Sent from the Maven - Users mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Overriding properties in a dependency's pom.xml
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 [EMAIL PROTECTED] 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: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- View this message in context: http://www.nabble.com/Overriding-properties-in-a-dependency%27s-pom.xml-tf2921218s177.html#a8684683 Sent from the Maven - Users mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Overriding properties in a dependency's pom.xml
On 1/4/07, mraible [EMAIL PROTECTED] 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: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Overriding properties in a dependency's pom.xml
I have a project that has dao.frameworkhibernate/dao.framework defined as a property in the root pom.xml. In a service project, that property is used as follows: dependency groupId${pom.groupId}/groupId artifactIdappfuse-${dao.framework}/artifactId version${pom.version}/version /dependency In turn, the service dependency is used in WAR projects: dependency groupId${pom.groupId}/groupId artifactIdappfuse-service/artifactId version${pom.version}/version exclusions /dependency From here, child projects use this WAR project (it's overlayed). We're using the Maven WarPath plugin (http://static.appfuse.org/plugins/maven-warpath-plugin/) to read dependencies from WARs. For some reason, if I put dao.frameworkibatis/dao.framework in my child project, it doesn't override the variable in the service/pom.xml. However, if I pass in -Ddao.framework=ibatis from the command-line, everything works. Is it possible to override property values in child projects - or is it only possible from the command-line? My child project does not refer to any other projects as parent projects. Matt -- View this message in context: http://www.nabble.com/Overriding-properties-in-a-dependency%27s-pom.xml-tf2921218s177.html#a8164734 Sent from the Maven - Users mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Overriding properties in a dependency's pom.xml
I tried setting the dao.framework property in settings.xml, but that didn't work either. It seems there's only two ways to set a DAO Framework with AppFuse/Maven. 1. Pass it in from the command-line: mvn jetty:run-war -Ddao.framework=jpa-hibernate 2. Set it in your MAVEN_OPTS environment variable: export MAVEN_OPTS='-Ddao.framework=jpa-hibernate'. Both of these seem pretty fragile as it requires end users to do something. If they don't set the MAVEN_OPTS variable, they'll end up with Hibernate instead of iBATIS or JPA. Is there a better way to do this? 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? Thanks, Matt mraible wrote: I have a project that has dao.frameworkhibernate/dao.framework defined as a property in the root pom.xml. In a service project, that property is used as follows: dependency groupId${pom.groupId}/groupId artifactIdappfuse-${dao.framework}/artifactId version${pom.version}/version /dependency In turn, the service dependency is used in WAR projects: dependency groupId${pom.groupId}/groupId artifactIdappfuse-service/artifactId version${pom.version}/version exclusions /dependency From here, child projects use this WAR project (it's overlayed). We're using the Maven WarPath plugin (http://static.appfuse.org/plugins/maven-warpath-plugin/) to read dependencies from WARs. For some reason, if I put dao.frameworkibatis/dao.framework in my child project, it doesn't override the variable in the service/pom.xml. However, if I pass in -Ddao.framework=ibatis from the command-line, everything works. Is it possible to override property values in child projects - or is it only possible from the command-line? My child project does not refer to any other projects as parent projects. Matt -- View this message in context: http://www.nabble.com/Overriding-properties-in-a-dependency%27s-pom.xml-tf2921218s177.html#a8173290 Sent from the Maven - Users mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]