You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Owen Jacobson <an...@gmail.com> on 2007/05/17 20:22:22 UTC
Property substitution based on dependencies
Salue.
I have a project that builds a JAR file and needs to package a config
file in the resulting JAR. The config file is an XML file that
contains some information that should be based on the JAR's
dependencies. Right now that information is hard-coded and has to be
updated by hand whenever I change the dependencies, which sucks.
I'd like to use resource filtering to automatically place either the
dependency version number or the complete dependency name (or
filename) in the config file.
Here's the relevant section of my POM:
<dependencies>
<dependency>
<groupId>foo</groupId>
<artifactId>foo-server</artifactId>
<scope>provided</scope>
<version>4.13</version>
<type>ejb</type>
</dependency>
</dependencies>
<build>
<resources>
<resource>
<directory>src/main/resources</directory>
<filtering>true</filtering>
</resource>
</resources>
</build>
There are no explicit properties defined anywhere in the POM or in settings.xml.
Here's the configuration file segment that I'd like to change:
<depends>
jboss.j2ee:module=foo-server-4.13.jar,service=EjbModule
</depends>
Is there any existing property created by maven automatically that
expands to any of
4.13 (the version of the foo:foo-server:4.13:ejb dependency)
foo-server-4.13 (the dependency's base name)
foo-server-4.13.jar (the dependency's filename, with no path info)
?
Owen
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org
Re: Property substitution based on dependencies
Posted by craigb <su...@gmail.com>.
Hi, I have exactly the same requirement as the original email.
I have a file, persistence.xml, that references a dependency version that is
listed in the project pom. I would like to be able to do something like
this:
persistence.xml
--------------
...
<jar-file>../lib/my-artifact-id-${project.dependencies["com.mycompany.blah:my-artifact-id"].version}.jar</jar-file>
...
and have it filtered by maven.
If this is not already possible, then I would be interested in providing a
patch, if any maven devs thought it was a good idea??
cheers,
Craig
Owen Jacobson-2 wrote:
>
> Salue.
>
> I have a project that builds a JAR file and needs to package a config
> file in the resulting JAR. The config file is an XML file that
> contains some information that should be based on the JAR's
> dependencies. Right now that information is hard-coded and has to be
> updated by hand whenever I change the dependencies, which sucks.
>
> I'd like to use resource filtering to automatically place either the
> dependency version number or the complete dependency name (or
> filename) in the config file.
>
> Here's the relevant section of my POM:
>
> <dependencies>
> <dependency>
> <groupId>foo</groupId>
> <artifactId>foo-server</artifactId>
> <scope>provided</scope>
> <version>4.13</version>
> <type>ejb</type>
> </dependency>
> </dependencies>
>
> <build>
> <resources>
> <resource>
> <directory>src/main/resources</directory>
> <filtering>true</filtering>
> </resource>
> </resources>
> </build>
>
> There are no explicit properties defined anywhere in the POM or in
> settings.xml.
>
> Here's the configuration file segment that I'd like to change:
>
> <depends>
> jboss.j2ee:module=foo-server-4.13.jar,service=EjbModule
> </depends>
>
> Is there any existing property created by maven automatically that
> expands to any of
>
> 4.13 (the version of the foo:foo-server:4.13:ejb dependency)
> foo-server-4.13 (the dependency's base name)
> foo-server-4.13.jar (the dependency's filename, with no path info)
>
> ?
>
> Owen
>
> ---------------------------------------------------------------------
> 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/Property-substitution-based-on-dependencies-tp10669664p17684943.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