Ben McCann
Ben McCann

Reputation: 18994

What jetty jar should I use?

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? Are any of these what I want for the embedded use case?

Upvotes: 15

Views: 17752

Answers (5)

WZee
WZee

Reputation: 181

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

Upvotes: 1

Mike
Mike

Reputation: 4550

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>

Upvotes: 0

user336590
user336590

Reputation: 71

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

Upvotes: 5

Ben McCann
Ben McCann

Reputation: 18994

I used jetty-webapp.

Upvotes: 4

Alan Krueger
Alan Krueger

Reputation: 4786

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

Upvotes: 4

Related Questions