You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Pankaj Tandon <pa...@gmail.com> on 2010/08/05 23:35:42 UTC

plugin descriptor missing mojos section

Hi,

I've been working on a plugin which I attached to the compile phase of the
life cycle. All seemed well and it was doing what was expected. Then I
decided to document the plugin in using mvn site. So I built out the apt
files and issued a mvn site. At that point something happened which I cannot
explain.

For one, the site plugin downloaded a bizzillion artifacts and that's ok.
But then I started getting a warning that my descriptor was out of whack:

[WARNING] *******************************************************
[WARNING] Deprecation Alert:
[WARNING] No mojo descriptors were found in this project which has a
packaging type of maven-plugin.
[WARNING] In future versions of the plugin tools, this will fail the build.
[WARNING] If this project is an archetype, change the packaging type from
maven-plugin to maven-archetype.
[WARNING] ********************************************************

But it built succesfully.

So unsuspectingly, I tried invoking my project (in which this plugin is
used) and found that it wasn't even invoked. Looking closer, I realized that
the packaged plugin.xml(in the META-INF dir) is missing the mojos node.
(Mine says <mojos/>).

I'm not sure what was downloaded by the site plugin but it sure broke a
perfect build I had going. I even deleted my local repo and re-downloaded,
but my plugin.xml still is missing the mojos section. 
I *do* have the correct annotations in my Mojo so that the mojo section
*should* be built out as expected. And at one point it was, given that I was
able to run and attach my plugin to the compile phase of the lifecycle.

So, can someone explain what's the deal here... Why is my plugin descriptor
not generating the mojos section as expected?

Thanks,
Pankaj

--------------
Here's my plugin descriptor:
<?xml version="1.0" encoding="UTF-8"?>
<plugin>
  <description>This plugin processes a precompiled jsp.</description>
  <groupId>com.xxx.adc.plugins</groupId>
  <artifactId>maven-metadatagenerator-plugin</artifactId>
  <version>1.0.0</version>
  <goalPrefix>metadatagenerator</goalPrefix>
  <isolatedRealm>false</isolatedRealm>
  <inheritedByDefault>true</inheritedByDefault>
  <mojos/>
  <dependencies>
    <dependency>
      <groupId>commons-lang</groupId>
      <artifactId>commons-lang</artifactId>
      <type>jar</type>
      <version>2.4</version>
    </dependency>
...

And here's another descriptor from a plugin that does work and was generated
a couple of months back: (Note that it has a proper mojos section:

<?xml version="1.0" encoding="UTF-8"?>
<plugin>
  <description>xxx</description>
  <groupId>com.xxx.plugins</groupId>
  <artifactId>nd-xxx-plugin</artifactId>
  <version>1.1.1</version>
  <goalPrefix>xxx</goalPrefix>
  <isolatedRealm>false</isolatedRealm>
  <inheritedByDefault>true</inheritedByDefault>
  <mojos>
    <mojo>
      <goal>xxx</goal>
      <description>xx</description>
      <requiresDirectInvocation>false</requiresDirectInvocation>
      <requiresProject>true</requiresProject>
      <requiresReports>false</requiresReports>
      <aggregator>false</aggregator>
      <requiresOnline>false</requiresOnline>
      <inheritedByDefault>true</inheritedByDefault>
      <phase>verify</phase>
      <implementation>com.xxx.plugins.xx.MyMojo</implementation>
      <language>java</language>
      <instantiationStrategy>per-lookup</instantiationStrategy>
      <executionStrategy>once-per-session</executionStrategy>
      <parameters>
        <parameter>
          <name>destinationList</name>
          <type>java.util.List</type>
          <required>true</required>
          
          ...

-- 
View this message in context: http://maven.40175.n5.nabble.com/plugin-descriptor-missing-mojos-section-tp2265972p2265972.html
Sent from the Maven - Users mailing list archive at Nabble.com.

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


Re: plugin descriptor missing mojos section

Posted by Pankaj Tandon <pa...@gmail.com>.
Just for the record, here's the solution if anyone else were to encounter
this:

My mistake was to do with basic annotation syntax:

In the header of my Mojo class, I had:


/**
 * This goal will process a ...
 * 
 * @goal metadatagenerator
 * @phase compile
 * @author Pankaj Tandon
 * 
 * 
 /
  
/**
 * This class is modified from the Ant Task ...
 * 
 */
public class MetadataMojo extends AbstractMojo {

...


Instead of 

/**
 * This goal will process a ...
 * 
 * @goal metadatagenerator
 * @phase compile
 * @author Pankaj Tandon
 * 
 * This class is modified from the Ant Task ...
 * 
 */
public class MetadataMojo extends AbstractMojo {

...

The extra block of comments threw my annotations off kilter and I did not
get the plugin descriptor generated correctly.

I introduced this comment before site generation and therefore the wild 
goose chase.

Hope this helps somebody :)

Pankaj

-- 
View this message in context: http://maven.40175.n5.nabble.com/plugin-descriptor-missing-mojos-section-tp2265972p2266613.html
Sent from the Maven - Users mailing list archive at Nabble.com.

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