You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Richard Allen <ri...@gtri.gatech.edu> on 2005/11/14 20:58:46 UTC

[m2] How to inject values into a bean within a collection defined as a plugin parameter?

I have an array (same question applies to Java Collections) that is 
defined as a parameter of a Mojo:

public class MyMojo extends AbstractMojo {
...
  /**
   * @parameter
   * @required
   */
  private Options[] optionsArray;
...
}

and within the Options bean, I would like to inject properties from Maven:

public class Options {
...
  /**
   * @parameter expression="${project.build.directory}"
   */
  private directory;
...
}

such that the plugin can be configured like:

      <plugin>
        ...
        <executions>
          <execution>
            ...
            <configuration>
              <optionsArray>
                <options>
                  ...
                </options>
                <options>
                  ...
                </options>
              </compilations>
            </configuration>
            ...
          </execution>
        </executions>
      </plugin>

Is there a way to make this happen? It seems like I should be able to do 
this since Maven is creating and populating the bean classes (Options 
class).

Thanks,
Richard Allen

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