Conflicting cross-version suffixes in: com.fasterxml.jackson.module:jackson-module-scala - scala

I've a problem building a module into a project with sbt 0.13.5 and scala 2.9.3, I have the dependency defined to
"com.fasterxml.jackson.module" %% "jackson-module-scala" % "2.2.3" % "provided"
and even when the scalaVersion is explicitly set, throws this error:
[error] Modules were resolved with conflicting cross-version suffixes in {file:/Users/me/Code/project/}module:
[error] com.fasterxml.jackson.module:jackson-module-scala _2.9.2, _2.9.3
This is a provided dependency, that works on other module of the same project with the same resolvers and the same explicit scala version, the only difference there is in the additional dependencies, failing project has
"bouncycastle" % "bcprov-jdk16" % "140" % "provided",
"com.jolbox" % "bonecp" % "0.7.1.RELEASE" % "provided",
"mysql" % "mysql-connector-java" % "5.1.18" % "provided",
"org.liquibase" % "liquibase-core" % "3.0.5" % "provided",
"org.jdbi" % "jdbi" % "2.51" % "provided",
"javax.mail" % "mail" % "1.4" % "provided",
"com.twitter" % "finagle-redis" % "6.6.2" % "provided",
"com.twitter" % "finatra" % "1.3.9" % "provided"
Any idea on how to fix this? It appeared when updated to sbt 0.13, in 0.12 works ok.

Ok, I see what the problem is, finatra 1.3.9 is compiled with scala 2.9.2 and there's a dependency on fasterxml, Tried to fix by cross version mapping but it's a nighmare of dependencies, so, upgrading all dependencies to 2.10 is working so far.

Related

upgrade from Scala 2.11.8 to 2.12.10 build fails at sbt due to conflicting cross-version suffixes

I am trying to upgrade my Scala version from 2.11.8 to 2.12.10. I made following changes in my sbt file.
"org.apache.spark" %% "spark-core" % "2.4.7" % "provided",
"org.apache.spark" %% "spark-sql" % "2.4.7" % "provided",
"com.holdenkarau" %% "spark-testing-base" % "3.1.2_1.1.0" % "test"
when I am build the sbt file, I am getting following error
[error] Modules were resolved with conflicting cross-version suffixes in ProjectRef(uri("file:/Users/user/IdeaProjects/project/"), "root"):
[error] io.reactivex:rxscala _2.12, _2.11
Tried following possible ways. but no luck.
("io.reactivex" % "rxscala_2.12" % "0.27.0").force().exclude("io.reactivex","rxscala_2.11")
2.Removed Scala verion=2.11.8 from File->project structure->global libraries.
Any Help will be very useful.
It would be best if you could post your entire build.sbt file so it could be reproduced, but as a starting point, the dependency spark-testing-base is pointing to the wrong Spark version. From the documentation:
So you include com.holdenkarau.spark-testing-base [spark_version]_1.0.0 and extend
Based on the information you have provided you should be using:
"com.holdenkarau" %% "spark-testing-base" % "2.4.7_1.1.0" % "test"

Cannot find ScalaCheckDrivenPropertyChecks

I upgraded my test dependencies for my play project and now I get this problem:
object scalacheck is not a member of package org.scalatestplus
[error] import org.scalatestplus.scalacheck.ScalaCheckDrivenPropertyChecks
These are my test dependencies:
"org.scalatest" %% "scalatest" % "3.2.3" % Test,
"org.scalamock" %% "scalamock" % "4.2.0" % "test",
"com.github.alexarchambault" %% "scalacheck-shapeless_1.14" % "1.2.1" % "test",
"org.scalatestplus.play" %% "scalatestplus-play" % "3.1.2" % "test, it",
Do I have some incompatible versioning going on here?
You don't have the right dependency:
"org.scalatestplus" %% "scalacheck-1-15" % "3.2.3.0"
Since you are using scalatest version 3.2.3, you should use scalacheck version 3.2.3.X, for compatability.
Here is its maven location, and this is its github repo.
Scala 2.13 Code run at Scastie.
Scala 2.12 Code run at Scastie.

Scala sbt order of imports

Is it possible to change the order of imports in sbt for scala compilation?
I have two unmanaged dependencies in the ./lib/ folder and the rest are managed dependencies in the sbt file:
libraryDependencies ++= Seq(
"org.slf4j" % "slf4j-api" % "1.7.10",
"org.slf4j" % "slf4j-simple" % "1.7.10",
"org.slf4j" % "slf4j-log4j12" % "1.7.10",
"com.typesafe" % "config" % "1.0.2",
"edu.washington.cs.knowitall.taggers" %% "taggers-core" % "0.4",
"com.rockymadden.stringmetric" % "stringmetric-core" % "0.25.3",
"org.apache.solr" % "solr-solrj" % "4.3.1",
"com.twitter" %% "util-collection" % "6.3.6",
"org.scalaj" %% "scalaj-http" % "0.3.10",
"commons-logging" % "commons-logging" % "1.2"
)
In Eclipse I can run my program, because I can change the order of imports in the java build path (I put unmanaged dependencies at the end).
However when I want to run it from the terminal:
sbt "run-main de.questionParser.Test"
I get the following error
[error] Exception in thread "main" java.lang.NoSuchMethodError: com.google.common.collect.Lists.reverse(Ljava/util/List;)Ljava/util/List;
So the final question is:
Is it possible to change the order of imports in sbt for scala compilation so that managed dependencies are included before unmanaged dependencies?

Cannot compile ScalaCheck with specs2 since upgrading

I used to use:
"org.scalacheck" %% "scalacheck" % "1.10.1" % "test" withSources() withJavadoc(),
"org.specs2" %% "specs2" % "1.14" % "test" withSources() withJavadoc(),
Which worked fine, then I upgraded my dependencies to what I think are the latest:
"org.scalacheck" %% "scalacheck" % "1.12.1" % "test" withSources() withJavadoc(),
"org.specs2" %% "specs2-core" % "2.4.15" % "test" withSources() withJavadoc(),
Which should be correct according to http://etorreborre.github.io/specs2/
But now ScalaCheck is not being recognised as a member of org.specs2
[error] /Users/me/src/aFile.scala:7: object ScalaCheck is not a member of package org.specs2
[error] import org.specs2.ScalaCheck
[error] ^
I've done sbt clean and removed by ivy cache rm -r ~/.ivy2/cache
You need to add the specs2-scalacheck module to your build.
The documentation is wrong, you need to add multiple SBT lines to the build file, in particular add one according to Erics answer.
Also do NOT add the following, it causes a bunch of other errors
"org.specs2" %% "specs2" % "2.4.15" % "test" withSources() withJavadoc(),

Why does activator/sbt add Scala version to pure Java library dependencies?

I'm using Typesafe Activator's last version (1.2.8 with Scala 2.11.x).
When I add a dependency "org.apache.httpcomponents" %% "httpclient" % "4.4-alpha1" to my project in build.sbt, something like this:
libraryDependencies ++= Seq(
"com.typesafe.akka" %% "akka-actor" % "2.3.4",
"com.typesafe.akka" %% "akka-testkit" % "2.3.4",
"org.scalatest" %% "scalatest" % "2.1.6" % "test",
"junit" % "junit" % "4.11" % "test",
"com.novocode" % "junit-interface" % "0.10" % "test",
"org.apache.httpcomponents" %% "httpclient" % "4.4-alpha1" // my added dependency
)
... and try to update the project ( in activator's cli ) I get an error:
[error] (*:update) sbt.ResolveException: unresolved dependency: org.apache.httpcomponents#httpclient_2.11;4.4-alpha1: not found
I know scala's version aren't binary compatible, but I try to get a pure-java library org.apache.httpcomponent#httpclient! Why does activator add "_2.11" at the end of artifactId and make wrong urls...? How to resolve it?
Change the first %% to a single %. The double character version is for fetching cross-built libraries, and yours isn't.