Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

DRY way of defining dependencies for both jetty:run and deployment

Tags:

maven-2

jetty

I'm wrapping up the build for a web project which supports two ways of running:

  • locally using mvn jetty-run;
  • deployed on an application sever.

For the application server many libraries are marked as provided, since otherwise classpath conflicts occur. At the same time, I have redeclared these dependencies as compile dependencies for the jetty-maven-plugin, since otherwise the goals does not run properly.

The build works like this, but I have a large number of duplicated libraries. Is there a cleaner way of doing this?

like image 373
Robert Munteanu Avatar asked Oct 06 '10 13:10

Robert Munteanu


People also ask

What is Jetty dependency?

This means that for a standard web application without JSP, the only non-jetty jar required to run is the servlet-api jar. Jetty does have some run-time optional dependencies. For example, the log mechanism contained in the jetty-util jar looks for an SLF4J jar on the classpath.

What does Mvn jetty run do?

Introduction. The Jetty Maven plugin is useful for rapid development and testing. You can add it to any webapp project that is structured according to the usual Maven defaults. The plugin can then periodically scan your project for changes and automatically redeploy the webapp if any are found.

How Jetty server works?

The Jetty Server is the plumbing between a collection of Connectors that accept HTTP connections, and a collection of Handlers that service requests from the connections and produce responses, with the work being done by threads taken from a thread pool.


1 Answers

Just to follow up on this JETTY-429 has been merged so you can with caution add a configuration parameter <useProvidedScope>true</useProvidedScope>. This will included the provided dependencies on the jetty plugin classpath.

It is worth reading JETTY-429 for details on the potential issues using this option can bring.

like image 90
Sam Turtel Barker Avatar answered Oct 16 '22 10:10

Sam Turtel Barker