score:53
You should replace the %%
(double percent) with single one.
libraryDependencies += "org.apache.pdfbox" % "pdfbox" % "1.8.2"
The double-percent is a convenience operator, and causes adding the _
+scalaVersion
postfix inside the path, which is _2.10
in your case. Single percent should fix the problem.
score:0
Short answer:
Use
libraryDependencies += "org.apache.pdfbox" % "pdfbox" % "1.8.2"
For java libraries, and
libraryDependencies += "org.scalactic" %% "scalactic" % "3.0.8"
For Scala libraries, where the difference is the double % for the scala library.
Long answer:
Scala is not backward compatible across major version, so a library compiled for scala 2.12.x cannot be used by a project written in scala 2.13.x.
So when writing a scala library, you will need to compile and publish it one time per scala major version you would like to support. When using a library in a project, you would then have to pick the version compiled for the same Scala major version as your are using. Doing this manually would be cumbersome, so SBT has built in support for it.
When publishing a library, you can add the crossScalaVersions key to SBT like
crossScalaVersions := Seq( "2.10.6", "2.11.11", "2.12.3" )
And then publish with sbt +publish
. This will make SBT build and publish a version of the library for both scala 2.10.6, 2.11.11 and 2.12.3. Note that the minor number is in-relevant, when it comes to compatibility for libraries. The published libraries, will have the name suffixed with _2.10
, _2.11
and _2.12
to show what scala version it is for. An alternative to using the SBT build in support for this, is to use the experimental plugin sbt-projectmatrix as this gives a lot more options, and often faster builds.
When using a library sbt can also help your use the one compiled for the correct scala version, and thats where %% comes into play. When specifying a library without the _ suffix in the name, but instead use %%, then sbt will fill in suffix matching the Scala major version your use, and thereby fetch the correct version of the library.
Source: stackoverflow.com
Related Query
- How to add native library dependencies to sbt project?
- Add library dependencies to SBT, for SBT (not the project managed by SBT)
- How do i use play ws library in normal sbt project instead of play?
- How to set up managed dependencies in an SBT 0.11 project having Build.scala
- How can I add jars from more than one unmanaged directory in an SBT .scala project configuration
- How to install library with SBT libraryDependencies in an Intellij project
- How to toggle between project and library dependencies in SBT?
- Multiple project dependencies in SBT native packager
- How to add Java dependencies to Scala projects's sbt file
- How to properly load a native library for sbt tests?
- How to add one SBT project as a dependency of another?
- Why does sbt assembly in Spark project fail with "Please add any Spark dependencies by supplying the sparkVersion and sparkComponents"?
- How to add dependencies in Eclipse which sbt and Play 2.0 can see
- Using IntelliJ, how to add dependency in an sbt project
- How to add other Scala project as dependencies in IntelliJ (Scala Plugin)
- How to force sbt to resolve dependencies with scalaVersion compatible with the dependent project
- How to Use Github project as jar file in current sbt library
- How to add keycloak-admin-client-api in sbt scala project
- How to add repositories which require authentication in sbt project
- Scala Play: how to add a github library to the project (securesocial)
- How to get source directories of all project dependencies of an sbt project?
- How to add dedendency in SBT project
- How to get Project dependencies from SBT console
- How to add "targets in compile" to a SBT project which is defined with lazy val root = project.in(".")
- How to add a jar file located in root folder to library dependency in sbt
- How can I download and add static files to a project using SBT
- How to add maven dependencies to Scala project
- How to chose a specific version of package added by different SBT library dependencies
- Add a .so library with class files to sbt scala project
- Scala: how to build Scala project with cross build alongside different library dependencies
More Query from same tag
- Sending writes to the mysql master and reads to slave in slick
- How can we create case class object from json in scala + play framework 2.0
- Lazy evaluation of values in sequence
- Can spark dataframe (scala) be converted to dataframe in pandas (python)
- Adding headers to diffy proxy before multicasting
- Build for different library versions with SBT
- AWS-JAVA-SDK: Unzipped size must be smaller than 262144000 bytes
- Scala: How to replace all element in a List?
- How to call constructor of Scala trait in Java subclass?
- Spark DataFrame Read And Write
- initialise a var in scala
- Providing a reactive api to a database
- using multiple war's to resolve multiple scala versions
- can case object act as a state
- Escape quotes is not working in spark 2.2.0 while reading csv
- Restart PlayConsole SBT server
- To see anonymous function declaration
- playframework2 and Scala - how to launch tests from IDEA?
- What is the base collection class in scala?
- On the road to understanding F-Bounded Polymorphism
- Mock scala objects method call in java class
- How are values transferred across threads in scala futures
- Scala Error - Expression of type Unit doesn't conform to expected type File
- beahviour of calling super in mixin
- scala Enumeration retrieving enum by withName when Value has argument
- scala use same logger into class and companion object
- Scala Partition/Collect Usage
- Scala pipelines - DSL for building a DAG workflow
- Shapeless Generic and case class toArray exception depending on field types
- Problems using Nothing bottom type while trying to create generic zeros for parametrized monoids