Hi!

I am having problem passing parameters from the pom to a bean in my maven
plugin.
I've read the section about  "Parameter Types With Multiple Values" on
http://maven.apache.org/guides/plugin/guide-java-plugin-development.html,
but still can't get it to work. It would really help with some documentation
on this matter.
E.g.:

 - the section on "Other Object Classes: This category covers any class
which does not implement java.util.Map, java.util.Collection, or
java.util.Dictionary." leaves a lot in the dark

 -  "implementation hint" is mentioned in "If the XML contains an
implementation hint, that is used", but what is it aka how do I hint?

Anyway, what I want to accomplish is fairly simple and I've simplified it as
much as possible (I think).

I have a Bean:

public class MyBean
{
    String outputFile;

    public String getOutputFile()
    {
        return this.outputFile;
    }

    public void setOutputFile(String outputFile)
    {
        this.outputFile = outputFile;
    }
}


NOTE: I don't want to/cannot have outputFile on the top level, since I there
will be other bean, e.g. MyOtherBean, that contain a outputFile
variable/parameter as well.

MyMojo extends AbstractMojo and has:

    /**
     * Configures MyBean
     * @parameter expression="${mybean}";
     */
    private MyBean myBean;


How do I configure this in my pom.xml? It fails with this:

  <build>
    <plugins>
      <plugin>
        <groupId>se.example.mymojo</groupId>
        <artifactId>mymojo-maven-plugin</artifactId>
        <configuration>
          <mybean>
                <outputFile>stdout</outputFile>
          </mybean>
        </configuration>
        <executions>
          <execution>
            <id>mybean-exec</id>
            <goals>
              <goal>generate</goal>
            </goals>
            <phase>generate-sources</phase>
          </execution>
        </executions>
      </plugin>
    </plugins>
  </build>

While debugging I know that:

 1. the plugin runs
 2. mybean != null
 3. mybean.getOutputFile() == null


What do I need to do to get this working?

I would really appreciate an answer on this issue since I am currently stuck
here.

Regards,
Jimisola
-- 
View this message in context: 
http://www.nabble.com/Passing-plugin-build-configuration-from-pom-to-a-custom-bean-tf1930560.html#a5287739
Sent from the Maven - Users forum at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to