maven-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Martin Gainty (JIRA)" <j...@codehaus.org>
Subject [jira] (MPLUGIN-240) PluginManager cannot locate @goal in Abstract Class in modello-maven-plugin
Date Fri, 01 Feb 2013 12:01:13 GMT

    [ https://jira.codehaus.org/browse/MPLUGIN-240?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=318476#comment-318476
] 

Martin Gainty commented on MPLUGIN-240:
---------------------------------------

Test-harness
   <plugin>
        <groupId>org.codehaus.modello</groupId>
        <artifactId>modello-maven-plugin</artifactId>
        <version>1.1</version>
        <executions>
	     <execution>
	       <phase>generate-sources</phase>
	       <goals>
	         <goal>java</goal>
	       </goals>
	     </execution>
	</executions>
        <configuration>
          <version>1.0.0</version>
          <modelFile>src/main/mdo/pluginRequirements.mdo</modelFile>
          <models>
            <model>src/main/mdo/pluginRequirements.mdo</model>
          </models>
          <useJava5>true</useJava5>
          <packageWithVersion>true</packageWithVersion>
          <outputDirectory>${project.build.directory}/generated-sources/modello</outputDirectory>
          <encoding>${project.build.sourceEncoding}</encoding>
          <domAsXpp3>false</domAsXpp3>
        </configuration>
 </plugin>

The error generated from test-harness:

 org.codehaus.modello.maven.AbstractModelloGeneratorMojo
 org.apache.maven.plugin.MojoExecutionException: Error generating: No such plugin: java at
 org.codehaus.modello.maven.AbstractModelloGeneratorMojo.doExecute(AbstractModelloGeneratorMojo.java:324)

plugin.xml contains:

<?xml version="1.0" encoding="UTF-8"?>
<plugin>
  <name>Modello Maven Plugin</name>
  <description>Modello Maven Plugin enables the use of Modello in Maven builds.</description>
  <groupId>org.codehaus.modello</groupId>
  <artifactId>modello-maven-plugin</artifactId>
  <version>1.1</version>
  <goalPrefix>modello</goalPrefix>
  <isolatedRealm>false</isolatedRealm>
  <inheritedByDefault>true</inheritedByDefault>
  <mojos>
    <mojo>
      <goal>java</goal>
      <description>generates java sources from mdo</description>
      <requiresDirectInvocation>false</requiresDirectInvocation>
      <requiresProject>false</requiresProject>
      <requiresReports>false</requiresReports>
      <aggregator>false</aggregator>
      <requiresOnline>false</requiresOnline>
      <inheritedByDefault>true</inheritedByDefault>
<implementation>org.codehaus.modello.maven.ModelloJavaMojo</implementation>
      <language>java</language>
      <instantiationStrategy>per-lookup</instantiationStrategy>
      <executionStrategy>once-per-session</executionStrategy>
      <threadSafe>false</threadSafe>
      <parameters>
       <parameter>
          <name>modelFile</name>
          <type>java.lang.String</type>
          <required>false</required>
          <editable>true</editable>
          <description>the model file</description>
         </parameter>
         <parameter>
          <name>outputType</name>
          <type>java.lang.String</type>
          <required>true</required>
          <editable>true</editable>
          <description>Output type</description>
        </parameter>
        <parameter>
          <name>outputDirectory</name>
          <type>java.io.File</type>
          <required>true</required>
          <editable>true</editable>
          <description>Output Directory</description>
        </parameter>
    	<parameter>
    	   <name>modelVersion</name>
    	   <type>java.lang.String</type>
    	   <required>true</required>
    	   <editable>true</editable>
    	   <description>version</description>
    	</parameter>
    	<parameter>
    	   <name>packageWithVersion</name>
    	   <type>java.lang.String</type>
    	   <required>true</required>
    	   <editable>true</editable>
    	   <description>packgeWithVersion</description>
    	</parameter>
    	<parameter>
    	    <name>useJava5</name>
    	    <type>java.lang.String</type>
    	    <required>true</required>
    	    <editable>true</editable>
    	    <description>useJava5</description>
    	</parameter>
         <parameter>
           <name>args</name>
           <type>java.lang.String</type>
           <required>false</required>
           <editable>true</editable>
           <description>model outputType output-directory modelVersion packageWithVersion
useJava5 encoding</description>
         </parameter>
      </parameters>
      <configuration>
        <modelFile implementation="java.lang.String" default-value="src/main/mdo/pluginRequirements.mdo">${modelFile}</modelFile>
        <outputType implementation="java.lang.String" default-value="java">${outputType}</outputType>
        <outputDirectory implementation="java.io.File" default-value="${basedir}/target/generated-sources/modello">${outputDirectory}</outputDirectory>
        <modelVersion implementation="java.lang.String" default-value="1.0">${modelVersion}</modelVersion>
        <packageWithVersion implementation="java.lang.String" default-value="1.0">${packageWithVersion}</packageWithVersion>
        <useJava5 implementation="java.lang.Boolean" default-value="true">${useJava5}</useJava5>
        <args implementation="java.lang.String" default-value="src/main/mdo/pluginRequirements.mdo,java,generated-sources/modello,1.0,org.codehaus.modello.maven,true,UTF-8">${args}</args>
      </configuration>
    </mojo>
  </mojos>

this is the class that the PluginManager locates..
Presumably because this is the only class which extends AbstractMojo

/**
 * @author <a href="mailto:trygvis@inamo.no">Trygve Laugst&oslash;l</a>
 * @version $Id$
 * @threadSafe
 */
public abstract class AbstractModelloGeneratorMojo
    extends org.apache.maven.plugin.AbstractMojo
{
 public abstract void execute() {...}
}
//notice there is no @goal because this is an abstract class
//pluginManager does NOT use implementation class but backtraces to locate
//which class extends AbstractMojo

/*solution for plugin is to place all
functionality into concrete implementor
which contains @goal e.g. */

/*** Echos an object string to the output screen.
 * @goal java
 * @requiresProject false
 @Mojo(name "java")
 */
 public class ModelloJavaMojo extends AbstractMojo implements
 org.codehaus.modello.core.ModelloCore
 { public void execute()
 }

Questions or comments on why PluginManager is locating Abstract class which extends AbstractMojo
and not locating implementation Java class are eagerly solicited
Martin
                
> PluginManager cannot locate @goal in Abstract Class in modello-maven-plugin
> ---------------------------------------------------------------------------
>
>                 Key: MPLUGIN-240
>                 URL: https://jira.codehaus.org/browse/MPLUGIN-240
>             Project: Maven 2.x Plugin Tools
>          Issue Type: Bug
>          Components: Metadata Model
>         Environment: maven 3.0.2 modello-maven-plugin-1.5
>            Reporter: Martin Gainty
>


--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://jira.codehaus.org/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Mime
View raw message