Class Buildr::Jetty
In: addon/buildr/jetty.rb  (CVS)
Parent: Object

Provides a collection of tasks and methods for using Jetty, specifically as a server for testing your application.

Build files should always start Jetty by invoking the use task, typically as a prerequisite. This task will start Jetty once during the build, and shut it down when the build completes.

If you want to keep Jetty running across builds, and look at error messages, you can start Jetty in a separate console with:

  buildr jetty:start

To stop this instance of Jetty, simply kill the process (Ctrl-C) or run:

  buildr jetty:stop

If you start Jetty separately from the build, the use task will connect to that existing server. Since you are using Jetty across several builds, you will want to cleanup any mess created by each build. You can use the setup and teardown tasks, which are called when Jetty is first used in the build, and when the build ends.

Methods

deploy   fire   instance   running?   setup   start   stop   teardown   undeploy   use  

Constants

VERSION = "6.1.3"   Which version of Jetty we‘re using by default (change with options.jetty.version).
SLF4J_VERSION = "1.4.3"
REQUIRES = [ "org.mortbay.jetty:jetty:jar:#{VERSION}", "org.mortbay.jetty:jetty-util:jar:#{VERSION}", "org.mortbay.jetty:servlet-api-2.5:jar:#{VERSION}", "org.slf4j:slf4j-api:jar:#{SLF4J_VERSION}", "org.slf4j:slf4j-simple:jar:#{SLF4J_VERSION}", "org.slf4j:jcl104-over-slf4j:jar:#{SLF4J_VERSION}" ]   Libraries used by Jetty.
URL = "http://localhost:8080"   Default URL for Jetty (change with options.jetty.url).

Attributes

url  [RW]  The URL for the Jetty server. Leave as is if you want to use the default server (localhost:8080).

Public Class methods

Public Instance methods

Deploy a WAR in the specified URL.

Returns true if it finds a running Jetty server that supports the Buildr requests for deploying, stopping, etc.

This task executes when Jetty is first used in the build. You can use it to deploy artifacts into Jetty.

Starts Jetty. This method does not return, it keeps the thread running until Jetty is stopped. If you want to run Jetty parallel with other tasks in the build, invoke the use task instead.

Stops Jetty. Stops a server running in a separate process.

This task executes when the build is done. You can use it to undeploy artifacts previously deployed into Jetty.

Undeploys a WAR from the specified URL.

If you intend to use Jetty, invoke this task. It will start a new instance of Jetty and close it when the build is done. However, if you already have a server running in the background (e.g. jetty:start), it will use that server and will not close it down.

Protected Instance methods

If you want to start Jetty inside the build, call this method instead of start. It will spawn a separate process that will run Jetty, and will stop Jetty when the build ends. However, if you already started Jetty from the console (with take jetty:start), it will use the existing instance without shutting it down.

[Validate]