I'll write a separate post for tomcat

It's probably that I haven't spent enough time writing maven plugins. However from this list I've been considering Maven plugins as follows

A) they are things that should be separate from Maven, therefore should be self contained and shouldn't ask about the environment B) related to this, environment should be strings and numbers etc, and only passed in via @parameter annotations C) Which makes ant tasks ideal. You can pass parameters to them and they are certainly independent from Maven D) How long will it take to replace all the ant tasks that everyone uses? Will they all get replaced? If there is just one that isn't and I need it, the docs for antrun suggest I'm doing something that is against the spirit of Maven and that I should rewrite it asap (might not even be my own source code).

Just to fabricate a 'real-world' example, imagine that I need to send a mail message when my build has been successful. Well I already know the ant mail task, so here's what I would normally call:


<mail mailhost="smtp.myisp.com" mailport="1025" subject="Test build">
  <from address="[EMAIL PROTECTED]"/>
  <replyto address="[EMAIL PROTECTED]"/>
  <to address="[EMAIL PROTECTED]"/>
  <message>${project.name} has installed</message>
</mail>


However with Maven why can't I write something like this:
(as you can see I'm not proposing we inline ant tasks like the antrun plugin)

          <plugin>
                <groupId>ant</groupId> ///////MADE UP
                <artifactId>core</artifactId>
                <version>1.0</version>
                <executions>
                    <execution>
                        <phase>install</phase>
                        <goals>
<goal>mail</goal> /////////// NAME OF ANT TASK
                        </goals>
                    </execution>
                </executions>
                <configuration> ///////////// TAGS COPIED FROM ANT TASK
                    <from><address>[EMAIL PROTECTED]</address></from>
                    <replyto><address>[EMAIL PROTECTED]</address></replyto>
                    <to><address>[EMAIL PROTECTED]</address></to>
<message>${project.name} has installed</ message> /////////USING A MAVEN PROP!!
                </configuration>
            </plugin>

Excuse the ill thought through syntax, especially when it comes to the group/artifact/version values, but hopefully this would be similar syntax as you'd use to configure any other plugin. And from the point of view of a maven user, ie not plugin writer, it seems a compelling use case. I'm not suggesting that custom plugins should be written as ant targets but I am suggesting that maybe the existing ant library tasks should be embraced as first class citizens in Maven also.

Maybe there is some aspect that I'm missing with the power of Maven plugins, but it seems with with a little effort on a plugin decorator for ant tasks, you could make maven instantly more powerful.

A couple of inline comments below...

Thanks
-AW

On 14 Sep 2005, at 13:16, Mark Hobson wrote:

Hi Ashley,

I would see the advantages of using a Maven-specific plugin rather
than an ant-based one as being:

* Reuse of ant targets - not having to specify repeated ant tasks over
many POMs (one of the main reasons for the existence of Maven itself)

* Tighter integration with the Maven build process - Maven plugins can
reuse POM and other plugin configuration themselves, whereas an
antrun-based alternative would have to repeatedly configure it's tasks

Not sure what the repeated configuration means - I express my configuration section just once don't I? Hopefully Maven would make things efficient under the hood.

* Minimal configuration required (as a result of the above)

* No ant dependencies or ant-based exceptions

The point of my post is that this is not a good thing - I would like Maven to know about ant (wrap exceptions if it pleases)

What problems were you having with the tomcat plugin?  I'm using it on
a daily basis and have no issues.  Admittedly some online
documentation would help, but I think the mojo.codehaus.org guys will
be setting up deployed sites and binaries soon.

Cheers,

Mark

On 14/09/05, Ashley Williams <[EMAIL PROTECTED]> wrote:

I'm currently trying to autodeploy my webapp to tomcat at the end of
my m2 install, and as far as I can tell there are two ways of doing
this:

1. Use the maven tomcat plugin beta. I tried this and had a devil of
a time trying to get it to work - not familiar with it, immature code
etc
2. Use the tomcat ant task. I believe there has been talk here about
the maven ant plugin which would enable me to just call the more
mature ant task that I already know.

So I suppose the question is more general: why would I ever use
custom maven plugins when I can just call the familiar ant equivalent
from within Maven? I'm believe I understand the benefits of the
transitive library dependencies and the built in build lifecycle but
I don't have a clear idea in my mind when it comes to how best to use
and write plugins.

Thanks
-AW

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




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




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

Reply via email to