Jetty Ant Plugin
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!
Re: Jetty Ant Plugin
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 :-)
Re: Jetty Ant Plugin
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
Re: Jetty Ant Plugin
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.
Re: Jetty Ant Plugin
cheers
Jan
Re: Jetty Ant Plugin (additional VM arguments)
I believe there are at least two ways to do that:
- Provide your VM args via ANT_OPTS environment property - your args will be available to the whole ant process;
- Execute your Jetty task in a separate ant process. You can do it via 'exec' task in ant. It allows you to specify VM args directly from the ant script.
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
