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 :-(
- 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.


Some questions:
- Is it correct that the 'groupId' for a plugin should always be 'org.apache.maven.plugins'?
- 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'.
- 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?.
- 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?


Hope somebody can help.
Thanks in advance,
Peter van de Hoef


--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to