Jetty has a sexy new plugin for Ant that has the same features as the Maven plugin. So if you didn't want to move from Ant to Maven, but you still want fast webapp development, now you can have it!
The Jetty Maven plugin greatly shortens your development cycle by allowing you to run jetty on your Maven webapp project without first having to assemble it into a fully-formed webapp. Moreover, it's able to scan the webapp and automatically redeploy it when changes are detected (eg to class files, descriptors, jars etc). You can imagine how convenient that is when you're using an IDE - you modify the source, the IDE compiles it in the background and your changes are then immediately reflected in the executing container.
Not everyone, however, is in a position to change to using Maven for building their webapps. Many folks are happy with (or are stuck with) using Ant, but would love to have the advantages of the Maven plugin.
Well, now they can! The Jetty Ant plugin brings you those same rapid development features.
Like the Maven plugin, the Ant plugin also directly supports configuration of jetty components like connectors, realms, request logs etc. Similarly, it also supports the use of a jetty.xml file to give you total control of the container environment for your webapp. As you'd expect, you can also specify a jetty-env.xml for doing fine-grained configuration of the JNDI resources.
Once you've done your initial configuration and setup it's as easy as typing:
ant jetty.run
Big thanks to Jakub Pawlowicz and Sabre Holdings for this outstanding contribution to the Jetty project!
Posted at 10:52PM Mar 08, 2007 by janb in General | Comments[14]
For example, AFAIK, the jetty plugin is the only one which scans for changes and automatically redeploys.
However, I'm sure if that feature isn't implemented yet, the Tomcat guys will be trying to catch up to us soon :-)
Posted by Jan Bartel on March 09, 2007 at 08:46 PM EST #
Posted by yawmark on March 18, 2007 at 07:27 PM EST #
We'll take a look to see if there's a way we can push pre-built jars from the jetty/extras module to a repo.
cheers
Jan
Posted by Jan Bartel on March 19, 2007 at 01:16 PM EST #
I have just been down the road of creating the Jetty6RunWarExploded manually, but reached a deadend when this class because the webApp property is set using a @property attribute, and no javabean property is present.
Maybe I should look at the Ant task source? It would be cool if a launcher class that monitored directories (and allowed for multiple resource base directories) was part of Jetty proper and the maven and ant tasks could just delegate to that module. It would also allow someone who wants to programmatically start Jetty to have their cake also.
Posted by Jim Cook on March 24, 2007 at 11:10 AM EST #
Jetty Ant Plugin Thank You
Best Regards...
Posted by Bayanlar on March 24, 2007 at 11:29 AM EST #
cheers
Jan
Posted by Jan Bartel on March 24, 2007 at 03:33 PM EST #
Is it possible to put such parameters to the Jetty Ant Plugin?
Best regards Andreas
Posted by Andreas Binder on May 09, 2007 at 01:00 AM EST #
I believe there are at least two ways to do that:
Please note, that it doesn't work well on Windows OS, because of some nasty bug (subprocess won't close if you close the parent process).
As you can see there's no way to specify VM args in the jetty task itself, which is because the ant plugin is not executed in a separate process.
However, we use both approaches to enable Java debugging for our web application and it works perfectly well.
I hope that answers your question.
Best Regards,
Jakub Pawlowicz
Posted by Jakub Pawlowicz on May 09, 2007 at 10:34 PM EST #
thanks for the suggestions. I think, in using the plugin for debugging and testing this is a quite good solution.
Best Regards,
Andreas
Posted by Andreas Binder on May 15, 2007 at 06:31 AM EST #
More on Ant Scripts in this non-profit resource on building large scale java applications:
<a href="http://coderslog.com/Ant_Scripts">Ant Script Samples</a>
Posted by Anonymous on May 24, 2007 at 01:20 PM EST #
Posted by Robert Kirkpatrick on March 05, 2010 at 09:47 PM EST #
Robert,
cheers,I'm not sure I understand your question. The wiki page at http://docs.codehaus.org/display/JETTY/Ant+Jetty+Plugin describes how to configure jetty connectors to accept HTTP requests when running jetty via the ant plugin.
Jan
Posted by Jan on April 06, 2010 at 04:45 AM EST #
Posted by Robert Kirkpatrick on April 13, 2010 at 02:58 AM EST #
Interesting! I haven't heard of such a set of ant tasks before. If you come across anyone willing to contribute an impl for Jetty, please email jetty-dev@eclipse.org and let us know.
cheers,Jan
Posted by Jan Bartel on April 13, 2010 at 10:48 PM EST #