Hi Simon,
ok that would work but only given that I do not use version intervals (which I
do).
If I do it like you said:
<dependencies>
<dependency>
...
<version>${myArtifactIdVersion</version>
</dependency>
</dependencies>
<properties>
<myArtifactIdVersion>[1.0,2.0)</myArtifactIdVersion>
</properties>
Then of course my filtered resource does not contain the actual version of the
dependency that's used but the interval "[1.0,2.0)". And that exactly is my
problem.
Thanks,
Jan
-----Ursprüngliche Nachricht-----
Von: simon [mailto:[EMAIL PROTECTED]
Gesendet: Montag, 18. Februar 2008 23:16
An: Maven Users List
Betreff: Re: Acess version of a dependency via property
On Mon, 2008-02-18 at 23:08 +0100, Stamer, Jan wrote:
> Hi all,
>
> is it possible to access the version of a dependency via a property?
>
> Detailed problem description:
>
> I have the following pom.xml:
> <dependencies>
> <dependency>
> <groupId>myGroupId</groupId>
> <artifactId>myArtifactId</artifactId>
> <version>41</version>
> </dependency>
> </dependencies>
> </project>
>
> Because I need to state the version of the dependency myGroupId.myArtrifactId
> in my code I want to use the version of the dependency and inject it via
> resource filtering.
>
> In my text resource Text.properties I tried these (neither of them works):
> ${pom.dependencies.dependency[0].version}
> ${pom.dependencies.dependency[0].groupId}
> ${pom.dependencies.dependency{0}.groupId}
> ${project.dependencies.dependency{0}.groupId}
> ${pom.dependencies.dependency[artifactId=myArtifactId]}
>
> Can anybody help me out?
I think this will do it:
<dependencies>
<dependency>
...
<version>${myArtifactIdVersion</version>
</dependency>
</dependencies>
<properties>
<myArtifactIdVersion>41</myArtifactIdVersion>
</properties>
Then enable resource-filtering; ${myArtifactIdVersion} should apply.
Regards,
Simon
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
___________________________________________
Cellent Finance Solutions AG
Firmensitz: Calwer Straße 33, 70173 Stuttgart
Registergericht: Amtsgericht Stuttgart, HRB 720743
Vorstand: Thomas Wild
Vorsitzender des Aufsichtsrats: Rudolf Zipf
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]