Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6709307
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T07:51:55+00:00 2026-05-26T07:51:55+00:00

I have a legacy war project that depends on a jar project, the jar

  • 0

I have a legacy war project that depends on a jar project, the jar project needs to add a few unmanaged jars to the classpath for compilation. But these jars should not be packaged in the war. So my question is how do I remove these entries from the fullClasspath. The following won’t work:

val excludeFilter = "(servlet-api.jar)|(gwt-dev.jar)|(gwt-user.jar)"
val filteredCP = cp.flatMap({ entry =>
   val jar = entry.data.getName()
   if (jar.matches(excludeFilter)) {
     Nil
   } else {
     Seq(entry)
   }
})
fullClasspath in Runtime = filteredCP

I am pretty sure there must be simple way to do this but so far it has eluded me.

Edit: Based on Pablo’s sugestion to use the managed classpath instead of the unmanaged I can rephrase the question as: how do you add local jars to the managedClasspath. My jars are placed in a local folder with a (very) nonstandard layout:

lib/testng.jar
lib/gwt/2.3/gwt-user.jar
lib/jetty/servlet.jar

So basically I am looking for something like:

libraryDependencies += "testng" % "provided->test"
libraryDependencies += "gwt" % "2.3" % "gwt-user" % "provided->compile"
libraryDependencies += "jetty" % "servlet" % "provided->default"

allowing me to grab jars from my own local lib folder.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T07:51:55+00:00Added an answer on May 26, 2026 at 7:51 am

    Some information is provided on the Classpaths page, but it is not very clear or detailed. The information is also available using the inspect command, described on the Inspecting Settings page.

    Basically, for a configuration X, in a short-hand notation:

    // complete, exported classpath, such as used by 
    //   'run', 'test', 'console', and the war task
    fullClasspath in X =
      dependencyClasspath in X ++ exportedProducts in X
    
    // classpath only containing dependencies, 
    //   used by 'compile' or 'console-quick', for example
    dependencyClasspath in X =
      externalDependencyClasspath in X ++ internalDependencyClasspath in X
    
    // classpath containing only dependencies external to the build
    //  (as opposed to the inter-project dependencies in internalDependencyClasspath)
    externalDependencyClasspath in X =
      unmanagedClasspath in X ++ managedClasspath in X
    
    // the manually provided classpath
    unmanagedClasspath in X =
      unmanagedJars for X and all configurations X extends, transitively
    

    So, normally, when you want to add unmanaged libraries, you add them to unmanagedJars. For example, if you add libraries to unmanagedJars in Compile, then sbt will correctly include the libraries on the unmanagedClasspath for Compile, Runtime, and Test.

    However, you want explicit control here. Add the libraries only to the unmanagedClasspath you want the jars on, which is unmanagedClasspath in Compile. For example, in sbt 0.11.0+:

    unmanagedClasspath in Compile <++= baseDirectory map { base =>
      val lib = base / "lib"
      Seq(
        lib / "testng.jar",
        lib / "gwt/2.3/gwt-user.jar",
        lib / "jetty/servlet.jar"
      )
    }
    

    Assuming the war plugin uses the Runtime classpath, those jars will only show up on the compile classpath and not in the war.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

So we have a busy legacy web service that needs to be replaced by
I would like to use CommonLibrary .NET in my project but I have legacy
We have some legacy code that needs to identify in the Page_Load which event
i have legacy j2ee project which is using struts 2 with spring. Now when
I installed silverlight 4 recently, but we still have legacy projects need to be
Setup I'm packaging a WAR with a number of legacy jar dependencies in it
I have legacy COM component, and my mission is to write web service that
I have legacy C++ code that changes a process DACL and am trying to
I have a legacy piece of software that has a single manager which controls
I am working on a legacy application which have a .war with following structure

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.