I'd like to create an application using the embedded version of Jetty. Unfortunately, I can't find any information on what jar files I would need to do that. There are several in the maven repository (http://repo2.maven.org/maven2/org/eclipse/jetty/aggregate/). But what's the difference between jetty-server, jetty-server-all, and jetty-webapp? 开发者_StackOverflow中文版 Are any of these what I want for the embedded use case?
I stopped getting compile errors against the Eclipse embedded code minimal example combining SimplestServer and HelloWorldHandler...
http://wiki.eclipse.org/Jetty/Tutorial/Embedding_Jetty
To achieve this I had to include the following from the lib directory in the unzipped distribution from eclipse's jetty mirror...
- jetty-server-7.1.4xxxx.jar
- jetty-util-7.1.4xxxx.jar
- servlet-api.2.5.jar
This document lists the JAR files required for embedding and is pretty complete.
http://docs.codehaus.org/display/JETTY/Embedding+Jetty
I believe you won't need the Ant jar file unless you're invoking Jetty from Ant, even though it says you need it.
Some of the JSP jar files are named differently in the binary bundle than that document calls for, but this document helps figure out which Jetty JSP jars to use:
http://docs.codehaus.org/display/JETTY/JSP+2.0+v+JSP+2.1
I used jetty-webapp.
All the dependencies are very best explained in this diagram : http://wiki.eclipse.org/Jetty/Reference/Dependencies
Based on the diagram,for embedded use case, a minimum of 6 jars are required. E.g for Jetty 8, try:
jetty-continuation-8..jar jetty-http-8..jar jetty-io-8..jar jetty-server-8..jar jetty-util-8.*.jar servlet-api-3.0.jar
For completeness, the xml for jetty-webapp is;
<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-webapp</artifactId>
<version>8.1.2.v20120308</version>
</dependency>
精彩评论