I never got a war working as jar, so I always go for one of the two solutions. However, when using a war, its not hard to setup a embedded Jetty server that works in your IDE. To do that you can use a WebAppContext
to set it up using a web.xml
. See this documentation for an example. From there, everything should work as advocated on the Guice site.
However, this will not create a runnable war (like java -jar yourapp.war
) because jars have a different internal layout. However, if you want to you can use the jetty-runner to fix this using java -jar jetty-runner.jar yourapp.war
.