You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tapestry.apache.org by Apache Wiki <wi...@apache.org> on 2008/06/15 17:16:55 UTC
[Tapestry Wiki] Update of "Tapestry5RunViaMain" by BenGidley
Dear Wiki user,
You have subscribed to a wiki page or wiki category on "Tapestry Wiki" for change notification.
The following page has been changed by BenGidley:
http://wiki.apache.org/tapestry/Tapestry5RunViaMain
New page:
== Create a Jetty Run Main Class ==
This method lets you create a class in your project that runs your application. This has a number of benefits
* Runs directly from compile output directory - so no waiting for copying files
* Works in all IDE's exactly the same
* Debugging/Profiling/Running work perfectly
This assumes you are running with Maven.
To make this work
1. Add a dependency on Jetty to your POM at provided scope. Use the jetty-server-dependencies and jetty-provided-apis artifacts
1. Turn off J2EE deployment in module properties
1. Add a class like the following to your src/test/resources
{{{
public class RunTapestryApp {
public static void main(String[] args) throws Exception {
Server server = new Server();
Connector connector = new SelectChannelConnector();
connector.setPort(Integer.getInteger("jetty.port", 8080));
server.setConnectors(new Connector[]{connector});
String jetty_home = System.getProperty("jetty.home", "./");
WebAppContext webapp = new WebAppContext();
webapp.setContextPath("/");
webapp.setWar(jetty_home + "src/main/webapp");
webapp.setDefaultsDescriptor(jetty_home + "src/test/resources/webdefault.xml");
// Remove slf4j from list of classes not exposed to webapp
webapp.setServerClasses(new String[] {"-org.mortbay.jetty.plus.jaas.", "org.mortbay.jetty."});
server.setHandler(webapp);
server.start();
server.join();
}
}
}}}
This might be a bad idea if you want to use Tapestry-test since it depends on Jetty 5 at present.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tapestry.apache.org
For additional commands, e-mail: dev-help@tapestry.apache.org