Skip to main content
Jump to: navigation, search

Jetty/Reference/Dependencies



Introduction

The jetty classes are are organized into almost 50 jars, so it is crucial to understand the organization and dependencies (internal or external) when creating classpaths for Jetty.

Maven Dependency

When working out dependency, the maven dependency:tree plugin is your friend. For example, to find out the dependencies of the jetty-servlet module:

# mvn -f jetty-servlet/pom.xml dependency:tree
[INFO] Scanning for projects...
[INFO] Searching repository for plugin with prefix: 'dependency'.
[INFO] ------------------------------------------------------------------------
[INFO] Building Jetty :: Servlet Handling
[INFO]    task-segment: [dependency:tree]
[INFO] ------------------------------------------------------------------------
[INFO] [dependency:tree]
[INFO] org.eclipse.jetty:jetty-servlet:jar:7.0.0.RC2-SNAPSHOT
[INFO] +- junit:junit:jar:3.8.2:test
[INFO] \- org.eclipse.jetty:jetty-security:jar:7.0.0.RC2-SNAPSHOT:compile
[INFO]    \- org.eclipse.jetty:jetty-server:jar:7.0.0.RC2-SNAPSHOT:compile
[INFO]       +- javax.servlet:servlet-api:jar:2.5:compile
[INFO]       +- org.eclipse.jetty:jetty-continuation:jar:7.0.0.RC2-SNAPSHOT:compile
[INFO]       \- org.eclipse.jetty:jetty-http:jar:7.0.0.RC2-SNAPSHOT:compile
[INFO]          \- org.eclipse.jetty:jetty-io:jar:7.0.0.RC2-SNAPSHOT:compile
[INFO]             \- org.eclipse.jetty:jetty-util:jar:7.0.0.RC2-SNAPSHOT:compile

Types of dependency

Jetty makes use of three types of maven dependency:

  • compile - these are real hard dependencies that you need to compile and run the code. In the above example, you can see that jetty-servlet has a single hard dependency on jetty-security, which has transitive dependencies on jetty-server, servlet-api, jetty-http, jetty-io, jetty-util.
  • provided (optional) - these are used for optional dependencies that are needed to compile the code, but are not necessary at runtime. For example jetty-util provide depends on org.slf4j:slf4j-api so that it can compile the Slf4jLogger, but slf4j is optional at runtime, so that if the dependency is not on the classpath, then the Slf4J logger is not used.
  • provided (environmental) - these dependencies are also used for dependencies that are expected to be present in a runtime environment. For example the test-jetty-webapp provide depends on the servlet-api so that it can be compiled against the API, but the servlet API is expected to be provided by the servlet container, so the servlet-api JAR is not included in the WEB-INF/lib of the assembled war file.
  • test - These dependencies are used for unit tests (but some integration tests are in modules with test-foo names and used normal compile dependencies to access common test resources).

Dependency Tree

Example.jpg

External Dependencies

start.jar

Aggregation Jars

Back to the top