RSS feed
<< Jetty supports Annotations for the JSF RI | Home | Jetty Session Clustering with Terracotta >>

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

Not that I want to get into some kind of pissing contest here, but I just wanted to mention that the maven plugins don't have quite the same feature set. 

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

I've been unable to locate the jetty-ant JAR in *any* maven2 repository, as of 3/14/2007. Any suggestions?

Re: Jetty Ant Plugin

The plugin is an optional extra and is currently not automatically built and pushed to the maven repos. For the moment, you have to download the jetty bundle from http://dist.codehaus.org/jetty and build it yourself - very simple (I also like the irony that it is built with maven :-) )

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 would like to start up Jetty programmatically but with all of the features of the Maven plugin (e.g.. monitor directories). Is there a means to do this already?

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

I think we have what you want :-)  Take a look at the wiki entry at http://docs.codehaus.org/display/JETTY/ContextDeployer.  The context deployer will do pretty much what the maven and ant plugins do in terms of deploying your webapp, watching for changes to it and automatically redeploying it when necessary.

cheers
Jan

Re: Jetty Ant Plugin

Jetty Ant Plugin  Thank You

 

Best Regards...

Re: Jetty Ant Plugin

I'd like to start jetty with additional vm parameters.
Is it possible to put such parameters to the Jetty Ant Plugin?

Best regards Andreas

Re: Jetty Ant Plugin (additional VM arguments)

Hi Andreas,

I believe there are at least two ways to do that:
  1. Provide your VM args via ANT_OPTS environment property - your args will be available to the whole ant process;
  2. 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

Re: Jetty Ant Plugin (additional VM arguments)

Hi Jacub,

thanks for the suggestions. I think, in using the plugin for debugging and testing this is a quite good solution.


Best Regards,
Andreas

Re: Jetty Ant Plugin

Hey.

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>

RE: Jetty Ant Plugin

It looks like Jetty has a new Plugin for Ant . If you've used the Jetty Maven Plugin , you know this is a slick way to quickly deploy your application. For those of you wondering about Tomcat, there's a similar Tomcat Maven Plugin that supports tomcat

Add a comment Send a TrackBack