|
View:
New views
7 Messages
—
Rating Filter:
Alert me
|
|
|
Overriding properties in a dependency's pom.xmlI have a project that has <dao.framework>hibernate</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> <artifactId>appfuse-${dao.framework}</artifactId> <version>${pom.version}</version> </dependency> In turn, the service dependency is used in WAR projects: <dependency> <groupId>${pom.groupId}</groupId> <artifactId>appfuse-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.framework>ibatis</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 |
|
|
Re: Overriding properties in a dependency's pom.xmlI 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
|
|
|
Re: Overriding properties in a dependency's pom.xmlOn 1/4/07, mraible <matt@...> 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@... For additional commands, e-mail: users-help@... |
|
|
Re: Overriding properties in a dependency's pom.xmlI'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
|
|
|
Re: Overriding properties in a dependency's pom.xmlBump.
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
|
|
|
Re: Overriding properties in a dependency's pom.xmlDamn, 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
|
|
|
|
| Free embeddable forum powered by Nabble | Forum Help |