You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Dave Comeau <DC...@xenos.com> on 2006/04/26 22:52:48 UTC

[M2] Newbie q: Looking for clear example on creating Ant Plugin/M ojo's

I'm new to Maven and trying to port our current Ant build system to M2.

So I'm trying to take the route of creating separate plugins for the various
Ant tasks that we currently perform, such as obfuscation.

I've been thrashing through lots of documentation, and finally discovered
the "Better Builds With Maven" book.  I've been trying to model my own
simple plugin (with an Ant Mojo) after the examples in chapter 5,
"Developing Custom Maven Plugins".  However, unlike the example in the book,
I'm not mixing Java and Ant Mojo's, I just have an Ant Mojo.

Unfortunately I find the guide a bit vague in terms of how and where the
xxx.build.xml / xxx.mojos.xml (in my case I have obfuscate.build.xml and
obfuscate.mojos.xml) files live in the project's directory structure.

When I build and install the plugin to my repository, the Jar file doesn't
contain the obfuscate.build.xml or obfuscate.mojos.xml files.

So when I then build my project that has this plugin bound to the lifecycle
(in the process-classes phase), I get the error below.  What I'm interested
in is finding some documentation that shows a more specific example of an
Ant plugin.

Also, I'm surprised that there is no Ant plugin archetype available that can
be used with the "archetype:create" plugin goal.  I used
"-DarchetypeArtifactId=maven-archetype-mojo" to setup this project, but it's
specific to Java Mojo's.  Aren't Ant based plugins quite common?

Thank you for your assistance.
Dave

[ERROR] BUILD ERROR
[INFO]
------------------------------------------------------------------------
[INFO] 'obfuscate' was specified in an execution, but not found in the
plugin
[INFO]
------------------------------------------------------------------------
[INFO] Trace
org.apache.maven.lifecycle.LifecycleExecutionException: 'obfuscate' was
specified in an execution, but not found in the plugin
        at
org.apache.maven.lifecycle.DefaultLifecycleExecutor.bindExecutionToLifecycle
(DefaultLifecycleExecutor.java:1337)
        at
org.apache.maven.lifecycle.DefaultLifecycleExecutor.bindPluginToLifecycle(De
faultLifecycleExecutor.java:1238)
        at
org.apache.maven.lifecycle.DefaultLifecycleExecutor.constructLifecycleMappin
gs(DefaultLifecycleExecutor.java:982)
        at
org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoal(DefaultLifec
ycleExecutor.java:453)
        at
org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalAndHandleFail
ures(DefaultLifecycleExecutor.java:306)
        at
org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeTaskSegments(Defa
ultLifecycleExecutor.java:273)
        at
org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLifecycle
Executor.java:140)
        at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:322)
        at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:115)
        at org.apache.maven.cli.MavenCli.main(MavenCli.java:256)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39
)
        at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl
.java:25)
        at java.lang.reflect.Method.invoke(Method.java:324)
        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]
------------------------------------------------------------------------




Re: [M2] Newbie q: Looking for clear example on creating Ant Plugin/M ojo's

Posted by jean-laurent de morlhon <je...@gmail.com>.
Your xxx.build.xml / xxx.mojos.xml should be placed by default into
the src/main/scripts directory of your plugin.

I didn't hjave a chance to take a look at this chapter of the book,
but there is a rather comprehensive documentation here  :
http://maven.apache.org/guides/plugin/guide-ant-plugin-development.html

On 4/26/06, Dave Comeau <DC...@xenos.com> wrote:
>
> I'm new to Maven and trying to port our current Ant build system to M2.
>
> So I'm trying to take the route of creating separate plugins for the various
> Ant tasks that we currently perform, such as obfuscation.
>
> I've been thrashing through lots of documentation, and finally discovered
> the "Better Builds With Maven" book.  I've been trying to model my own
> simple plugin (with an Ant Mojo) after the examples in chapter 5,
> "Developing Custom Maven Plugins".  However, unlike the example in the book,
> I'm not mixing Java and Ant Mojo's, I just have an Ant Mojo.
>
> Unfortunately I find the guide a bit vague in terms of how and where the
> xxx.build.xml / xxx.mojos.xml (in my case I have obfuscate.build.xml and
> obfuscate.mojos.xml) files live in the project's directory structure.
>
> When I build and install the plugin to my repository, the Jar file doesn't
> contain the obfuscate.build.xml or obfuscate.mojos.xml files.
>
> So when I then build my project that has this plugin bound to the lifecycle
> (in the process-classes phase), I get the error below.  What I'm interested
> in is finding some documentation that shows a more specific example of an
> Ant plugin.
>
> Also, I'm surprised that there is no Ant plugin archetype available that can
> be used with the "archetype:create" plugin goal.  I used
> "-DarchetypeArtifactId=maven-archetype-mojo" to setup this project, but it's
> specific to Java Mojo's.  Aren't Ant based plugins quite common?
>
> Thank you for your assistance.
> Dave
>
> [ERROR] BUILD ERROR
> [INFO]
> ------------------------------------------------------------------------
> [INFO] 'obfuscate' was specified in an execution, but not found in the
> plugin
> [INFO]
> ------------------------------------------------------------------------
> [INFO] Trace
> org.apache.maven.lifecycle.LifecycleExecutionException: 'obfuscate' was
> specified in an execution, but not found in the plugin
>         at
> org.apache.maven.lifecycle.DefaultLifecycleExecutor.bindExecutionToLifecycle
> (DefaultLifecycleExecutor.java:1337)
>         at
> org.apache.maven.lifecycle.DefaultLifecycleExecutor.bindPluginToLifecycle(De
> faultLifecycleExecutor.java:1238)
>         at
> org.apache.maven.lifecycle.DefaultLifecycleExecutor.constructLifecycleMappin
> gs(DefaultLifecycleExecutor.java:982)
>         at
> org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoal(DefaultLifec
> ycleExecutor.java:453)
>         at
> org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalAndHandleFail
> ures(DefaultLifecycleExecutor.java:306)
>         at
> org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeTaskSegments(Defa
> ultLifecycleExecutor.java:273)
>         at
> org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLifecycle
> Executor.java:140)
>         at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:322)
>         at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:115)
>         at org.apache.maven.cli.MavenCli.main(MavenCli.java:256)
>         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>         at
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39
> )
>         at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl
> .java:25)
>         at java.lang.reflect.Method.invoke(Method.java:324)
>         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]
> ------------------------------------------------------------------------
>
>
>
>
>


--
Jean-Laurent

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