Skip to main content
Jump to: navigation, search

Difference between revisions of "Jetty/Reference/Dependencies"

Line 36: Line 36:
 
== Dependency Tree ==
 
== Dependency Tree ==
 
[[Image:Jetty-7.0.0-dependencies.png]]
 
[[Image:Jetty-7.0.0-dependencies.png]]
 +
 +
This diagram shows the compile dependencies for the jetty project. The external dependencies are listed on the right hand side and all other modules shown are part of the project.  The dependencies are best understood in the following groups:
 +
=== HTTP ===
 +
The jetty-util, jetty-io and jetty-http jars form the core of the jetty HTTP handler (generation and parsing) that is used for both the jetty-client and the jetty-server
 +
 +
=== Server ===
 +
Together with the HTTP jars, the jetty-server, jetty-continuation and server-api jars make up the minimal dependencies needed to run a HTTP server. Note that while the servlet-api is used for requests and responses, this is not a servlet server and jetty handlers must be used to generate responses.
 +
 +
=== Servlets and Webapps ===
 +
If the jetty-security and jetty-servlet modules are added to the server dependencies, then you have the capability run standard Servlets and Filters, but these must be configured programatically.  If the jetty-xml and jetty-webapp modules are included, then standard web applications and WAR files may be run using web.xml configuration.  The jetty-deploy module then adds the ability to discover and deploy war files in application server style.
 +
 +
=== Plus ===
 +
The jetty-jndi, jetty-plus and jetty-annotation modules together add more J2EE-like capabilities that are often collectively called "Jetty Plus"
  
 
== External Dependencies ==
 
== External Dependencies ==

Revision as of 21:40, 22 July 2009



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

Jetty-7.0.0-dependencies.png

This diagram shows the compile dependencies for the jetty project. The external dependencies are listed on the right hand side and all other modules shown are part of the project. The dependencies are best understood in the following groups:

HTTP

The jetty-util, jetty-io and jetty-http jars form the core of the jetty HTTP handler (generation and parsing) that is used for both the jetty-client and the jetty-server

Server

Together with the HTTP jars, the jetty-server, jetty-continuation and server-api jars make up the minimal dependencies needed to run a HTTP server. Note that while the servlet-api is used for requests and responses, this is not a servlet server and jetty handlers must be used to generate responses.

Servlets and Webapps

If the jetty-security and jetty-servlet modules are added to the server dependencies, then you have the capability run standard Servlets and Filters, but these must be configured programatically. If the jetty-xml and jetty-webapp modules are included, then standard web applications and WAR files may be run using web.xml configuration. The jetty-deploy module then adds the ability to discover and deploy war files in application server style.

Plus

The jetty-jndi, jetty-plus and jetty-annotation modules together add more J2EE-like capabilities that are often collectively called "Jetty Plus"

External Dependencies

start.jar

Aggregation Jars

Back to the top