Using properties-maven-pluginin dependency management

View: New views
2 Messages — Rating Filter:   Alert me  

Using properties-maven-pluginin dependency management

by Tuomas Kiviaho :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

I am unable to get properties-maven-plugin to work with dependencyManagement section of the pom. I was trying to replace my invoker plugin placeholders as traditional ones to be able to run the invoker project as standalone project but failed.

<dependency>
        <groupId>junit</groupId>
        <artifactId>junit</artifactId>
        <version>@JUNIT_VERSION@</version>
        <scope>test</scope>
</dependency>

would have become

<dependency>
        <groupId>junit</groupId>
        <artifactId>junit</artifactId>
        <version>${junit.version}</version>
        <scope>test</scope>
</dependency>

and version information would have come from replaceable pom.properties.

properties-maven-plugin injected properties work perfectly everywhere else but not within dependencies. I tried both validate and initialize phase and I can see with properties writer that in borh cases the injected properties are there but maven fails to acknowledge them in dependency management. Both 2.1 and maven embedder (m2eclipse) have this problem.

Any pointers where to fill in an issue or alternative approaches?

--
Tuomas

Re: Using properties-maven-pluginin dependency management

by Benjamin Bentmann :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Tuomas Kiviaho wrote:

> I am unable to get properties-maven-plugin to work with dependencyManagement
> section of the pom.

This is not an issue of the plugin itself but a consequence of the way
the effective POM is constructed by Maven's core. All POM elements
except plugin configurations are only interpolated once, namely ahead of
the execution of any plugin. Hence, no plugin can contribute values used
for interpolation of dependency elements.


Benjamin

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email