SBT, Jetty and Servlet 3.0

10,322

Solution 1

See this bug: https://jira.codehaus.org/browse/JETTY-1493

The crux of the issue is that ivy doesn't support the orbit extension and needs to map the orbit packaging type to jar. Not sure if you're using ivy or not there, but the fundamental reason is the same, you can see that by looking at the url it is downloading from maven central.

This bug has a bit more of the background on the reason we switched to these dependencies in the first place.

https://bugs.eclipse.org/bugs/show_bug.cgi?id=371954

Solution 2

I found a workaround. Further information can be found here: SBT, Jetty and Servlet 3.0.

classpathTypes ~= (_ + "orbit")

libraryDependencies ++= Seq(
  "org.eclipse.jetty.orbit" % "javax.servlet" % "3.0.0.v201112011016" % "container"         artifacts (Artifact("javax.servlet", "jar", "jar")
  )
)

libraryDependencies ++= Seq(
  "org.eclipse.jetty" % "jetty-webapp" % "8.1.4.v20120524" % "container" artifacts            (Artifact("jetty-webapp", "jar", "jar"))
)

Solution 3

with sbt 0.12+ (from:https://github.com/sbt/sbt/issues/499)

libraryDependencies ++= Seq(
    "org.eclipse.jetty" % "jetty-webapp" % "8.1.7.v20120910" % "container",
    "org.eclipse.jetty.orbit" % "javax.servlet" % "3.0.0.v201112011016" % "container" artifacts Artifact("javax.servlet", "jar", "jar")
)
Share:
10,322
Piotr Buda
Author by

Piotr Buda

Updated on June 04, 2022

Comments

  • Piotr Buda
    Piotr Buda about 2 years

    I have a really tiny problem.

    I have the following build.sbt file:

    name := "Tueet"
    
    libraryDependencies += "org.eclipse.jetty" % "jetty-webapp" % "8.1.2.v20120308"
    

    After invoking sbt update, I get the following:

    [info] Set current project to Tueet (in build file:/C:/dev/tueet/)
    [info] Updating {file:/C:/dev/tueet/}default-d5e982...
    [info] Resolving org.scala-lang#scala-library;2.9.1 ...
    [info] Resolving org.eclipse.jetty#jetty-webapp;8.1.2.v20120308 ...
    [info] Resolving org.eclipse.jetty#jetty-xml;8.1.2.v20120308 ...
    [info] Resolving org.eclipse.jetty#jetty-util;8.1.2.v20120308 ...
    [info] Resolving org.eclipse.jetty#jetty-servlet;8.1.2.v20120308 ...
    [info] Resolving org.eclipse.jetty#jetty-security;8.1.2.v20120308 ...
    [info] Resolving org.eclipse.jetty#jetty-server;8.1.2.v20120308 ...
    [info] Resolving org.eclipse.jetty.orbit#javax.servlet;3.0.0.v201112011016 ...
    [info] Resolving org.eclipse.jetty#jetty-continuation;8.1.2.v20120308 ...
    [info] Resolving org.eclipse.jetty#jetty-http;8.1.2.v20120308 ...
    [info] Resolving org.eclipse.jetty#jetty-io;8.1.2.v20120308 ...
    [warn]  [NOT FOUND  ] org.eclipse.jetty.orbit#javax.servlet;3.0.0.v201112011016!javax.servlet.orbit (603ms)
    [warn] ==== public: tried
    [warn]   http://repo1.maven.org/maven2/org/eclipse/jetty/orbit/javax.servlet/3.0.0.v201112011016/javax.servlet-3.0.0.v201112011016.orbit
    [warn]  ::::::::::::::::::::::::::::::::::::::::::::::
    [warn]  ::              FAILED DOWNLOADS            ::
    [warn]  :: ^ see resolution messages for details  ^ ::
    [warn]  ::::::::::::::::::::::::::::::::::::::::::::::
    [warn]  :: org.eclipse.jetty.orbit#javax.servlet;3.0.0.v201112011016!javax.servlet.orbit
    [warn]  ::::::::::::::::::::::::::::::::::::::::::::::
    [error] {file:/C:/dev/tueet/}default-d5e982/*:update: sbt.ResolveException: download     failed: org.eclipse.jetty.orbit#javax.servlet;3.0.0.v201112011016!javax.servlet.orbit
    [error] Total time: 1 s, completed 2012-03-27 14:33:34
    

    This is silly, as it works in Maven no prob. I found out that this is because Orbit does something with packaging (they set it to orbit apparently).

    I tried doing exclude("org.eclipse.jetty.orbit", "javax.servlet") but nothing happened and it still needed that dependency.

    I couldn't find any info on how to actually fix this, maybe someone will help me here :)

    Update: the presented bug provides a workaround, so to fix this problem I actually changed build.sbt to

    name := "Tueet"
    
    libraryDependencies += "org.eclipse.jetty" % "jetty-server" % "8.1.2.v20120308"
    
    ivyXML := 
    <dependency org="org.eclipse.jetty.orbit" name="javax.servlet" rev="3.0.0.v201112011016">
    <artifact name="javax.servlet" type="orbit" ext="jar"/>
    </dependency>