Skip to main content

Notice: this Wiki will be going read only early in 2024 and edits will no longer be possible. Please see: https://gitlab.eclipse.org/eclipsefdn/helpdesk/-/wikis/Wiki-shutdown-plan for the plan.

Jump to: navigation, search

Difference between revisions of "Jetty/Howto/Use Jetty with Maven"

< Jetty‎ | Howto
m
 
(4 intermediate revisions by 2 users not shown)
Line 1: Line 1:
 +
{{Jetty TODO}}
 +
 
Some very simple instructions that will let you execute the SimplestServer example from the [[Jetty/Tutorial/Embedding Jetty | Embedding Jetty]] tutorial.
 
Some very simple instructions that will let you execute the SimplestServer example from the [[Jetty/Tutorial/Embedding Jetty | Embedding Jetty]] tutorial.
  
Line 24: Line 26:
 
         </dependency>
 
         </dependency>
 
     </dependencies>
 
     </dependencies>
 +
 +
If you want to run the OneServletContext example you'll also need access to ServletContextHandler and ServletHolder classes together with the HttpServlet and related classes. For this you can replace the dependency on jetty-server with a dependency on the jetty-servlet artifact.
 +
 +
    <dependency>
 +
        <groupId>org.eclipse.jetty</groupId>
 +
        <artifactId>jetty-servlet</artifactId>
 +
        <version>${jetty.version}</version>
 +
    </dependency>
 +
 +
See also the pages on the [[Jetty/Feature/Jetty_Maven_Plugin | Jetty Maven Plugin]].

Latest revision as of 15:12, 23 April 2013

Warning2.png
Some or all of this content remains to be ported to Jetty 9 Documentation.
If you are interested in migrating this content see our contribution guide or contact us.


Some very simple instructions that will let you execute the SimplestServer example from the Embedding Jetty tutorial.

In your pom enter the following.

   <!-- TODO 1 Pick the version of jetty you want. -->
   <properties>
       <jetty.version>7.1.6.v20100715</jetty.version>
   </properties>

   <!-- TODO 2 Configure repo2.maven.org as a repository. -->
   <repositories>
       <repository>
           <id>repo2_maven_org</id>
           <url>http://repo2.maven.org/maven2</url>
       </repository>
   </repositories>
    
   <!-- TODO 3 Set up dependency to get the jetty-server artifact. -->
   <dependencies>
       <dependency>
           <groupId>org.eclipse.jetty</groupId>
           <artifactId>jetty-server</artifactId>
           <version>${jetty.version}</version>
       </dependency>
   </dependencies>

If you want to run the OneServletContext example you'll also need access to ServletContextHandler and ServletHolder classes together with the HttpServlet and related classes. For this you can replace the dependency on jetty-server with a dependency on the jetty-servlet artifact.

   <dependency>
       <groupId>org.eclipse.jetty</groupId>
       <artifactId>jetty-servlet</artifactId>
       <version>${jetty.version}</version>
   </dependency>

See also the pages on the Jetty Maven Plugin.

Back to the top