When I put my concrete Mojo in a different module/plugin/jar from the
abstract Mojo, the plugin.xml that is generated contains:

    <mojo>
      <goal>unpack-config</goal>
      <description>Goal that unpacks the project dependencies from the
repository to a defined location.</description>
      <requiresDependencyResolution>compile</requiresDependencyResolution>
      <requiresDirectInvocation>false</requiresDirectInvocation>
      <requiresProject>true</requiresProject>
      <requiresReports>false</requiresReports>
      <aggregator>false</aggregator>
      <requiresOnline>false</requiresOnline>
      <inheritedByDefault>true</inheritedByDefault>
      <phase>compile</phase>
      
<implementation>org.codehaus.mojo.dependency.UnpackConfigMojo</implementation>
      <language>java</language>
      <instantiationStrategy>per-lookup</instantiationStrategy>
      <executionStrategy>once-per-session</executionStrategy>
      <parameters>
        <parameter>
          <name>unpackMarkersDirectory</name>
          <type>java.io.File</type>
          <required>true</required>
          <editable>false</editable>
          <description>Directory to store flag files after unpack</description>
        </parameter>
      </parameters>
      <configuration>
        <unpackMarkersDirectory
implementation="java.io.File">${project.build.directory}/maven-dependency-plugin-markers</unpackMarkersDirectory>
      </configuration>
    </mojo>


When I put both classes in the same module, then plugin.xml contains:

    <mojo>
      <goal>unpack-config</goal>
      <description>Goal that unpacks the project dependencies from the
repository to a defined location.</description>
      <requiresDependencyResolution>compile</requiresDependencyResolution>
      <requiresDirectInvocation>false</requiresDirectInvocation>
      <requiresProject>true</requiresProject>
      <requiresReports>false</requiresReports>
      <aggregator>false</aggregator>
      <requiresOnline>false</requiresOnline>
      <inheritedByDefault>true</inheritedByDefault>
      <phase>compile</phase>
      
<implementation>org.codehaus.mojo.dependency.UnpackConfigMojo</implementation>
      <language>java</language>
      <instantiationStrategy>per-lookup</instantiationStrategy>
      <executionStrategy>once-per-session</executionStrategy>
      <parameters>
        <parameter>
          <name>dependencies</name>
          <type>java.util.Collection</type>
          <required>true</required>
          <editable>false</editable>
          <description>List of all direct dependencies</description>
        </parameter>
        <parameter>
          <name>excludeTransitive</name>
          <type>boolean</type>
          <required>false</required>
          <editable>true</editable>
          <description>If we should exclude transitive
dependencies</description>
        </parameter>
        <parameter>
          <name>excludeTypes</name>
          <type>java.lang.String</type>
          <required>false</required>
          <editable>true</editable>
          <description>Comma Separated list of Types to exclude. Empty
String indicates don't exclude anything (default). Ignored if
includeTypes is used.</description>
        </parameter>
        <parameter>
          <name>includeTypes</name>
          <type>java.lang.String</type>
          <required>false</required>
          <editable>true</editable>
          <description>Comma Separated list of Types to include. Empty
String indicates include everything (default).</description>
        </parameter>
        <parameter>
          <name>outputDirectory</name>
          <type>java.io.File</type>
          <required>true</required>
          <editable>true</editable>
          <description>Output location used for mojo.</description>
        </parameter>
        <parameter>
          <name>overWriteReleases</name>
          <type>boolean</type>
          <required>false</required>
          <editable>true</editable>
          <description>Force Overwrite.</description>
        </parameter>
        <parameter>
          <name>overWriteSnapshots</name>
          <type>boolean</type>
          <required>false</required>
          <editable>true</editable>
          <description>Force Overwrite.</description>
        </parameter>
        <parameter>
          <name>patternSets</name>
          <type>org.apache.maven.model.PatternSet</type>
          <required>false</required>
          <editable>true</editable>
          <description>File patterns to exclude/include in unarchive
operation</description>
        </parameter>
        <parameter>
          <name>project</name>
          <type>org.apache.maven.project.MavenProject</type>
          <required>true</required>
          <editable>false</editable>
          <description>POM</description>
        </parameter>
        <parameter>
          <name>reactorProjects</name>
          <type>java.util.List</type>
          <required>true</required>
          <editable>false</editable>
          <description>Contains the full list of projects in the
reactor.</description>
        </parameter>
        <parameter>
          <name>scope</name>
          <type>java.lang.String</type>
          <required>true</required>
          <editable>false</editable>
          <description>Scope to include. An Empty string indicates all
scopes (default).</description>
        </parameter>
        <parameter>
          <name>unpackMarkersDirectory</name>
          <type>java.io.File</type>
          <required>true</required>
          <editable>false</editable>
          <description>Directory to store flag files after unpack</description>
        </parameter>
        <parameter>
          <name>useSubDirectoryPerType</name>
          <type>boolean</type>
          <required>false</required>
          <editable>true</editable>
          <description>Place each type of file in a separate
subdirectory. (example /outputDirectory/jars /outputDirectory/wars
etc)</description>
        </parameter>
      </parameters>
      <configuration>
        <dependencies
implementation="java.util.Collection">${project.dependencies}</dependencies>
        <outputDirectory implementation="java.io.File"
default-value="${project.build.directory}/dependency">${outputDirectory}</outputDirectory>
        <excludeTransitive implementation="boolean"
default-value="false">${excludeTransitive}</excludeTransitive>
        <scope implementation="java.lang.String"
default-value="">${scope}</scope>
        <excludeTypes implementation="java.lang.String"
default-value="">${excludeTypes}</excludeTypes>
        <project
implementation="org.apache.maven.project.MavenProject">${project}</project>
        <overWriteReleases implementation="boolean"
default-value="false">${overWriteReleases}</overWriteReleases>
        <reactorProjects
implementation="java.util.List">${reactorProjects}</reactorProjects>
        <includeTypes implementation="java.lang.String"
default-value="">${includeTypes}</includeTypes>
        <unpackMarkersDirectory
implementation="java.io.File">${project.build.directory}/maven-dependency-plugin-markers</unpackMarkersDirectory>
        <useSubDirectoryPerType implementation="boolean"
default-value="false">${useSubDirectoryPerType}</useSubDirectoryPerType>
        <overWriteSnapshots implementation="boolean"
default-value="true">${overWriteSnapshots}</overWriteSnapshots>
      </configuration>
      <requirements>
        <requirement>
          
<role>org.codehaus.mojo.dependency.archiver.manager.ArchiverManager</role>
          <field-name>archiverManager</field-name>
        </requirement>
      </requirements>
    </mojo>

On 1/15/06, Sasvata Chatterjee <[EMAIL PROTECTED]> wrote:
> I ran into this while experimenting with the dependency-maven-plugin.  
> dependency-maven-plugin has an abstract class (AbstractFromDependenciesMojo) 
> that, in turn, extends AbstractMojo.  The abstract class defines various 
> fields which the Maven plugin system is supposed to inject.
>
>  I created a separate plugin which declares a dependency in the POM on the 
> dependency-maven-plugin, and then provided a concrete Mojo extending 
> AbstractFromDependenciesMojo.  When I run my plugin, all the fields defined 
> in the abstract class are null.  If I move my concrete Mojo class into the 
> dependency-maven-plugin directly, without any other changes at all, then all 
> the fields are set correctly.  Alternatively, if I copy the abstract class 
> directly in my plugin  (and rename the package to avoid the duplication), it 
> seems to work.
>
>  Is this something I am doing incorrectly, or is this a known issue?
>
>  Thanks,
>  Shash
>

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

Reply via email to