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]

Reply via email to