the maven-plugin-plugin processes javadoc annotations to derive the plugin
metadata.

when you extend a maven-plugin artifact, the maven-plugin-plugin cannot see
the javadoc annotations of the parent mojo classes (because they are javadoc
annotations and it only has access to the .class files)

As a result it is not possible to extend a maven plugin... which leads to
the pattern whereby you have a jar artifact for doing the heavy lifting and
a skinny maven-plugin artifact to bind the jar to maven.... [oh look that's
actually best practice as now you are not tied to using maven as a build
tool, you can easily write a skinny ANT task wrapper to switch to ANT, etc]

You could avoid using maven-plugin-plugin and write the plugin metadata
yourself, or you could develop a patch to m-p-p to merge metadata (i'll
apply the patch for you if you can develop such... promise ;-) )

Of couse when we eventually switch to using java 5 annotations the issue
will be gone as those annotations can have a rentention into the .class
files

-Stephen

On 24 May 2010 22:12, Michael Delaney <mdela...@upromise.com> wrote:

> All,
>
> I'm trying to write a custom packing plugin that uses the Maven assembly
> descriptors but I'm running into some issues with my class. Just trying to
> proof out my concepts, I copied the class DirectoryMojo and changed the
> package name, added it to my Maven plugin and built the plugin; the plugin
> compiled with no issues.
>
> I then took a simple app with an assembly descriptor and tried to use my
> new packing plugin but I'm getting a null exception during the phase where
> it builds. Can anyone point me to in the right direction?
>
> -- POM configuration in helloWorld app.
> <plugin>
> <groupId>org.example.plugin</groupId>
> <artifactId>custom-packaging-plugin</artifactId>
> <version>1.0.0-SNAPSHOT</version>
> <configuration>
> <descriptors>
> <descriptor>${basedir}/src/main/assembly/custom.xml</descriptor>
> </descriptors>
> </configuration>
> </plugin>
>
> -- helloWorld build error
> [INFO] [sample-project:custom-assembly {execution: default-cli}]
> [INFO] Creating custom artifact now...
> [INFO]
> ------------------------------------------------------------------------
> [ERROR] FATAL ERROR
> [INFO]
> ------------------------------------------------------------------------
> [INFO] null
> [INFO]
> ------------------------------------------------------------------------
> [INFO] Trace
> java.lang.NullPointerException
>        at
> org.apache.maven.plugin.assembly.mojos.AbstractDirectoryMojo.execute(AbstractDirectoryMojo.java:49)
>        at
> org.apache.maven.plugin.assembly.mojos.CustomAssemblyMojo.execute(CustomAssemblyMojo.java:40)
>        at
> org.apache.maven.plugin.DefaultPluginManager.executeMojo(DefaultPluginManager.java:490)
>        at
> org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:694)
>        at
> org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeStandaloneGoal(DefaultLifecycleExecutor.java:569)
>        at
> org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoal(DefaultLifecycleExecutor.java:539)
>        at
> org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalAndHandleFailures(DefaultLifecycleExecutor.java:387)
>        at
> org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeTaskSegments(DefaultLifecycleExecutor.java:284)
>        at
> org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLifecycleExecutor.java:180)
>        at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:328)
>        at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:138)
>        at org.apache.maven.cli.MavenCli.main(MavenCli.java:362)
>        at
> org.apache.maven.cli.compat.CompatibleMain.main(CompatibleMain.java:60)
>        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>        at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
>        at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
>        at java.lang.reflect.Method.invoke(Unknown Source)
>        at
> org.codehaus.classworlds.Launcher.launchEnhanced(Launcher.java:315)
>        at org.codehaus.classworlds.Launcher.launch(Launcher.java:255)
>        at
> org.codehaus.classworlds.Launcher.mainWithExitCode(Launcher.java:430)
>        at org.codehaus.classworlds.Launcher.main(Launcher.java:375)
> [INFO]
> ------------------------------------------------------------------------
> [INFO] Total time: 19 seconds
> [INFO] Finished at: Mon May 24 16:53:57 EDT 2010
> [INFO] Final Memory: 44M/127M
> [INFO]
> ------------------------------------------------------------------------
>
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscr...@maven.apache.org
> For additional commands, e-mail: dev-h...@maven.apache.org
>
>

Reply via email to