You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Olivier Dehon <od...@gmail.com> on 2007/06/21 14:13:21 UTC

Interpolated expression to reference configuration elements of another plugin

Hi,

What ${} expression should I use in my POM or Mojo to reference 
configuration
values of another plugin?
I couldn't find any FAQ or reference on this. Sorry if this is indeed an 
FAQ.

Thanks in advance.

-Olivier



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: Interpolated expression to reference configuration elements of another plugin

Posted by Olivier Dehon <od...@gmail.com>.
Steven Rowe wrote:
>> What ${} expression should I use in my POM or Mojo to reference
>> configuration values of another plugin?
>>     
> If you define a property in the POM, and then use ${} syntax to refer to
> the property in the configuration for one plugin, you can refer to this
> same property value anywhere else in the POM, including in another
> plugin's configuration.
>   
That's one way to go indeed. Thanks for your answer.

The problem I am trying to solve is as follows:
I am writing a plugin, which works in conjunction with the war plugin.
In this plugin, I would like to re-use some of the configured values, 
even if
they have not been explicitly set in the POM (like warSourceDirectory or 
webXml).

In my Mojo, I could then use something along the lines of:

/*
 * @parameter expression=${project.build.plugin.war.warSourceDirectory}
 */

Hopefully I made myself clearer?

-Olivier

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: Interpolated expression to reference configuration elements of another plugin

Posted by Steven Rowe <sa...@syr.edu>.
Hi Olivier,

Olivier Dehon wrote:
> What ${} expression should I use in my POM or Mojo to reference
> configuration values of another plugin?

This doesn't directly answer your question, but since it's not clear
exactly what problem you're trying to solve, here's a solution to a
different problem :) :

If you define a property in the POM, and then use ${} syntax to refer to
the property in the configuration for one plugin, you can refer to this
same property value anywhere else in the POM, including in another
plugin's configuration.  E.g.:

...
<properties>
  <myprop>my value</myprop>
</properties>
...
<build>
  ...
  <plugins>
    ...
    <plugin>
      <groupId>my-group-id</groupId>
      <artifactId>my-first-artifact-id</artifactId>
      <configuration>
        <config-item>${myprop}</config-item>
      </configuration>
    </plugin>
    <plugin>
      <groupId>my-group-id</groupId>
      <artifactId>my-second-artifact-id</artifactId>
      <configuration>
        <another-config-item>${myprop}</another-config-item>
      </configuration>
    </plugin>
    ...
  </plugins>
  ...
</build>


Steve

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org