Well there's always the wicket solution. (It doesn't have to do anything with wicket, but it can be found in the wicket maven archetype.)
Use a main class that starts jetty programmatically with the project as webapp context. This should pick up all maven dependencies even in provided scope on all major IDEs. Here is such a class:
public class Start{
private static final Logger LOG = Logger.getLogger(Start.class);
public static void main(final String[] args) throws Exception{
LOG.addAppender(new ConsoleAppender(new SimpleLayout(), "system.out"));
final Server server = new Server();
final SocketConnector connector = new SocketConnector();
// Set some timeout options to make debugging easier.
connector.setMaxIdleTime(1000 * 60 * 60);
connector.setSoLingerTime(-1);
connector.setPort(9090);
server.setConnectors(new Connector[] { connector });
final WebAppContext bb = new WebAppContext();
bb.setServer(server);
bb.setContextPath("/");
bb.setWar("src/main/webapp");
server.addHandler(bb);
try{
LOG.info(//
">>> STARTING EMBEDDED JETTY SERVER, PRESS ANY KEY TO STOP" //
);
server.start();
System.in.read();
LOG.info(">>> STOPPING EMBEDDED JETTY SERVER");
server.stop();
server.join();
} catch(final Exception e){
LOG.error("Something bad happened", e);
System.exit(100);
}
}
// CHECKSTYLE:ON
}
The nice part: you can launch this as a standard eclipse run configuration, including easy debugging.
The downside: you need jetty as an additional provided
dependency:
<!-- JETTY DEPENDENCIES FOR TESTING -->
<dependency>
<groupId>org.mortbay.jetty</groupId>
<artifactId>jetty</artifactId>
<version>${jetty.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.mortbay.jetty</groupId>
<artifactId>jetty-util</artifactId>
<version>${jetty.version}</version>
<scope>provided</scope>
</dependency>