On Thu, 14 Apr 2005, Peter van de Hoef wrote:
Hi, I'll try to answer some of your questions..
> Hi all,
>
> I have been experimenting with Maven-2.0-alpha-1 for some time now and
> it looks very promising. Thank you very much.
>
> The things I like most:
> - No more jelly coding for plugins!
> - No more property files!
> - I realy like the new POM and its extension mechanism. Parent POMs are
> not included anymore via the <extend> tag but are a versioned resource
> in the repository.
> - It is much faster than Maven 1.
>
> Now I'm trying to rewrite my plugins the Maven 2 way.
>
> For anyone who is interested, this was the first working attempt. I
> called it 'hellomojo'. It consists of a 'pom.xml':
>
> <project>
> <artifactId>maven-hellomojo-plugin</artifactId>
> <version>1.0-SNAPSHOT</version>
> <packaging>maven-plugin</packaging>
> <groupId>org.apache.maven.plugins</groupId>
> <dependencies>
> <dependency>
> <groupId>org.apache.maven</groupId>
> <artifactId>maven-core</artifactId>
> <version>2.0-SNAPSHOT</version>
> </dependency>
> </dependencies>
> <modelVersion>4.0.0</modelVersion>
> </project>
>
> and a single java file: 'HelloMojo.java':
>
> package hellomojo;
> import org.apache.maven.plugin.AbstractPlugin;
> import org.apache.maven.plugin.PluginExecutionException;
> /** @goal hellomojo */
> public class HelloMojo extends AbstractPlugin
> {
> public void execute() throws PluginExecutionException
> {
> getLog().info( "Hello from Mojo " + this.getClass().getName() );
> }
> }
>
> Some notes:
> - It took me 2 hours to find out that
> <packaging>maven-plugin</packaging> has to be specified to make it into
> a maven plugin :-(
Then you didn't read
http://maven.apache.org/maven2/developing-plugins-with-marmalade.html
and didn't use maven archetype:create -Darchetype=mojo :)
> - I had to specify <version>1.0-SNAPSHOT</version> since that appears to
> be the default. Maven will still try to download the '1.0-SNAPSHOT'
> version if another version number is used.
Maybe that's what you supplied in a pom using this plugin?
> Some questions:
> - Is it correct that the 'groupId' for a plugin should always be
> 'org.apache.maven.plugins'?
It used to be - I think it's fixed now but not sure.. same thing for the
artifactId maven-XXX-plugin..
> - Are there any requirements for the package name of the Mojo. I guess
> not, since, for example, the 'clean' plugin resides in package
> 'org.apache.maven.plugin.clean' and the 'deploy' plugin resides in
> 'org.apache.maven.plugin.deploy'.
No, that is arbitrary (although you don't make a point :))
> - From the sources of the current plugins, I deduced that the name of
> the goal is defined by a '@goal' tag in the class comment (e.g. @goal
> deploy).
> How can I specify a 'default' goal? This is not clear from the examples
> I studied, e.g. the 'clean' plugin must be started via 'clean:clean'
> whereas the 'deploy' plugin can be started with the 'deploy' goal and
> not 'deploy:deploy' as I would expect, there appears to be a default
> goal here, but how is it specified?.
There are no default goals. Goals can be bound to a phase.
compile, package, install, deploy are a few phases. You can do that
with the @phase PHASENAME tag.
So when you specify @phase compile,
your goal is called when you call m2 compile, but also when you call
m2 hellomojo:hellomojo (m2 plugin-name:goal-name where plugin-name
is resolved to maven-plugin-name-plugin..)
> - In my plugin, I need to download files from the internet. In the old
> plugin, I used <ant:get>. Will there be comparable functionality in
> Maven 2? I have been studying the 'org.apache.maven.wagon.*' packages,
> and they look very sophisticated. Are these packages supposed to be used
> by plugins or will there be an ant-like library in the future?
You can use marmalade scripting (the easiest), but otherwise you'd have to
implement it in your plugin. You can always call ant from within
your plugin code. For now, that's the only way to 'script'. There should
be support for jelly but I haven't seen it yet..
Hope this helps a little..
Greetings,
Kenney Westerhof
> Hope somebody can help.
> Thanks in advance,
> Peter van de Hoef
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
--
Kenney Westerhof
http://www.neonics.com
GPG public key: http://www.gods.nl/~forge/kenneyw.key
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]