I have a very classic build.sbt
for Play 2.3 Scala project with the following libraryDependencies
setting:
libraryDependencies ++= Seq(
"org.scalatestplus" % "play_2.10" % "1.1.0" % "test"
"org.mockito" % "mockito-core" % "1.9.5" % "test"
)
lazy val portal = (project in file(".")).enablePlugins(PlayScala)
The PlayScala
plugin adds specs2
dependency that "pollutes" classpath and makes good import harder in IDE.
How can I remove a dependency from libraryDependencies
?
On the Project menu, choose Project Dependencies. The Project Dependencies dialog box opens. On the Dependencies tab, select a project from the Project drop-down menu. In the Depends on field, clear the check boxes beside any other projects that are no longer dependencies of this project.
We exclude dependencies in SBT by using either the exclude or excludeAll keywords. It's important to understand which one to use: excludeAll is more flexible but cannot be represented in a pom. xml. Therefore, we should use exclude if a pom.
All new SBT versions (after 0.7. x ) by default put the downloaded JARS into the . ivy2 directory in your home directory. If you are using Linux, this is usually /home/<username>/.
If you have JAR files (unmanaged dependencies) that you want to use in your project, simply copy them to the lib folder in the root directory of your SBT project, and SBT will find them automatically.
I solved a similar problem by adding the following to my Build.scala
:
def excludeSpecs2(module: ModuleID): ModuleID =
module.excludeAll(ExclusionRule(organization = "org.specs2"))
val main = Project(appName, file("."))
.enablePlugins(play.PlayScala)
.settings(libraryDependencies ~= (_.map(excludeSpecs2)))
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With