Hello all,

Creating a plugin, I would like to use the default compile source
roots for source lookup, but let the user override the default values
at wish. 

I've added the following in my Mojo:

    /**
     * The source directories containing the sources to be formatted.
     *
     * @parameter  property="sources" 
default-value="${project.compileSourceRoots}"
     */
    private List aSources;

    
which produces the following plugin.xml:

    <mojo>
      <goal>experiment</goal>
      <requiresDirectInvocation>false</requiresDirectInvocation>
      <requiresProject>true</requiresProject>
      <requiresReports>false</requiresReports>
      <aggregator>false</aggregator>
      <requiresOnline>false</requiresOnline>
      <inheritedByDefault>true</inheritedByDefault>
      <implementation>com.systems.plugin.maven.MyMojo</implementation>
      <language>java</language>
      <instantiationStrategy>per-lookup</instantiationStrategy>
      <executionStrategy>once-per-session</executionStrategy>
      <parameters>
        <parameter>
          <name>sources</name>
          <type>java.util.List</type>
          <required>false</required>
          <editable>true</editable>
          <description>The source directories containing the sources to be 
formatted.</description>
        </parameter>
      </parameters>
      <configuration>
        <sources implementation="java.util.List" 
default-value="${project.compileSourceRoots}"/>
      </configuration>
    </mojo>


Looks good to me, but when I create a POM and configure the sources
attribute, the specified value is ignored and only the default value
used!

    <plugin>
      <groupId>com.systems.plugin.maven</groupId>
      <artifactId>systems</artifactId>
      <configuration>
        <sources>
          <source>v:/test/demo.java</source>
        </sources>
      </configuration>
      <executions>
        <execution>
          <phase>process-classes</phase>
          <goals>
            <goal>experiment</goal>
          </goals>
        </execution>
      </executions>
    </plugin>


If I remove the default-value="${project.compileSourceRoots}"
attribute from the @parameter tag, the custom value is used, but then
I don't get any default value.

I'm using Maven 2.0.4 on a WinXP box and a Sun 5.0_09 VM. Am I doing
something wrong here or is such a configuration not possible? Any help
would be appreciated! Thank you.


My current workaround is to add another field which provides the
default value and merge the information later on. But according to the
documentation it should be possible to leverage the default-value
attribute and such a solution would be preferred.

Cheers,


Marco Hunsicker


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

Reply via email to