Publishing my FAT Jar to local sbt repo - scala

This is my build.sbt file
lazy val myproject = (project in file(".")).settings(
name := "Slick3Test2",
organization := "com.foo",
version := "1.2",
scalaVersion := "2.11.8",
libraryDependencies ++= Seq(
"com.typesafe.slick" %% "slick" % "3.2.0"
),
assemblyShadeRules in assembly := Seq(
ShadeRule.rename("slick.**" -> "shaded.#1").inAll
),
artifact in (Compile, assembly) := {
val art = (artifact in (Compile, assembly)).value
art.copy(`classifier` = Some("assembly"))
},
addArtifact(artifact in (Compile, assembly), assembly)
)
I published this locally using sbt publish-local
Now I referenced this is another project build.sbt
name := "Slick2Test"
version := "1.0"
scalaVersion := "2.11.8"
libraryDependencies ++= Seq(
"mysql" % "mysql-connector-java" % "5.1.36",
"com.typesafe.slick" % "slick_2.11" % "2.1.0",
"com.foo" %% "Slick3Test2" % "1.2"
)
But I get an error
[info] Resolving jline#jline;2.12.1 ...
[warn] ::::::::::::::::::::::::::::::::::::::::::::::
[warn] :: UNRESOLVED DEPENDENCIES ::
[warn] ::::::::::::::::::::::::::::::::::::::::::::::
[warn] :: com.foo#Slick3Test2_2.11;1.2: java.text.ParseException: inconsistent module descriptor file found in '/Users/foo/.ivy2/local/com.foo/Slick3Test2_2.11/1.2/ivys/ivy.xml': bad module name: expected='Slick3Test2_2.11' found='slick3test2_2.11';
[warn] ::::::::::::::::::::::::::::::::::::::::::::::
[warn]
[warn] Note: Unresolved dependencies path:
[warn] com.abhi:Slick3Test2_2.11:1.2 (/Users/foo/IdeaProjects/Slick2Test/build.sbt#L7-12)
[warn] +- default:slick2test_2.11:1.0
[trace] Stack trace suppressed: run 'last *:ssExtractProject' for the full output.
[trace] Stack trace suppressed: run 'last *:update' for the full output.
[error] (*:ssExtractProject) sbt.ResolveException: unresolved dependency: com.foo#Slick3Test2_2.11;1.2: java.text.ParseException: inconsistent module descriptor file found in '/Users/foo/.ivy2/local/com.foo/Slick3Test2_2.11/1.2/ivys/ivy.xml': bad module name: expected='Slick3Test2_2.11' found='slick3test2_2.11';
[error] (*:update) sbt.ResolveException: unresolved dependency: com.foo#Slick3Test2_2.11;1.2: java.text.ParseException: inconsistent module descripto

Your error has nothing to do with publishing FAT jar to your local repository!
I believe the error is pretty descriptive itself:
com.foo#Slick3Test2_2.11;1.2: java.text.ParseException: inconsistent module descriptor file found in '/Users/foo/.ivy2/local/com.foo/Slick3Test2_2.11/1.2/ivys/ivy.xml': bad module name: expected='Slick3Test2_2.11' found='slick3test2_2.11';
Especially: expected='Slick3Test2_2.11' found='slick3test2_2.11';
That being said, your dependency should probably look like:
libraryDependencies ++= Seq(
...
"com.foo" %% "slick3test2" % "1.2"
)
If you are not certain what is the artifactID of your library, you can always check it on your own, at:
${user.home}/.ivy2/local
Also keep in mind that local repository has precedence before cache and what is more, if some library version is found at you local cache, it will not be fetched from external servers.

Related

sbt unresolved library dependencies

sbt compile issues unresolved dependencies error
Research SBT configuration. I do have the correct syntax. But SBT still issues error
name := "MyProject"
version := "1.0"
scalaVersion := "2.11.12"
resolvers +=
"Sonatype OSS Snapshots" at "https://oss.sonatype.org/content/repositories/releases"
libraryDependencies += "java.io.IOException" % "IOException" % "latest.integration"
libraryDependencies += "java.io.FileReader" % "FileReader" % "latest.integration"
libraryDependencies += "java.io.FileNotFoundExceptiom" % "FileNotFoundException" % "latest.integration"
I have a working scala program. I expect the dependencies to be included instead I receive the following Warning. What am I missing?
Warning Message
[warn] ::::::::::::::::::::::::::::::::::::::::::::::
[warn] :: UNRESOLVED DEPENDENCIES ::
[warn] ::::::::::::::::::::::::::::::::::::::::::::::
[warn] :: java.io.IOException#IOException;latest.integration: not found
[warn] :: java.io.FileReader#FileReader;latest.integration: not found
[warn] :: java.io.FileNotFoundExceptiom#FileNotFoundException;latest.integration: not found
[warn] ::::::::::::::::::::::::::::::::::::::::::::::
hmm, there's something weird.
Typically you declare dependencies in a form of a lib/jar that does contain a set of classes, and not the individual class itself.
In your specific case, you don't even need to add any dependency to get java.io.* classes since it belong to standard library and are included by default

How to set up blueeyes project in SBT?

I'm having trouble setting up this project using SBT.
It does not resolve blueeyes dependency when I type sbt run:
[warn] ::::::::::::::::::::::::::::::::::::::::::::::
[warn] :: UNRESOLVED DEPENDENCIES ::
[warn] ::::::::::::::::::::::::::::::::::::::::::::::
[warn] :: com.reportgrid#blueeyes_2.9.1.RC1;0.4.19: not found
[warn] ::::::::::::::::::::::::::::::::::::::::::::::
[warn]
[warn] Note: Unresolved dependencies path:
[warn] com.reportgrid:blueeyes_2.9.1.RC1:0.4.19 (.../blueeyes-example/build.sbt#L19-22)
[warn] +- com.foo:blueeyes-test-api_2.9.1.RC1:0.1.0
[trace] Stack trace suppressed: run last *:update for the full output.
[error] (*:update) sbt.ResolveException: unresolved dependency: com.reportgrid#blueeyes_2.9.1.RC1;0.4.19: not found
The BlueEyes project on Github seems abandoned but I hope there's still someone who can help me with this!
Form the documentation of the blueeyes repository, the dependencies should be declares like this:
resolvers ++= Seq(
"Sonatype" at "http://oss.sonatype.org/content/repositories/public",
"Typesafe" at "http://repo.typesafe.com/typesafe/releases/"
)
libraryDependencies ++= Seq(
"com.github.jdegoes" %% "blueeyes-core" % "0.6.0",
"com.github.jdegoes" %% "blueeyes-mongo" % "0.6.0",
"com.github.jdegoes" %% "blueeyes-json" % "0.6.0",
"ch.qos.logback" % "logback-classic" % "1.0.0" % "runtime"
)
your library dependencies look a bit different:
libraryDependencies ++= Seq(
"com.reportgrid" % "blueeyes_2.9.1.RC1" % "0.4.19" % "compile"
)
UPDATE:
And scala version needs to be
scalaVersion := "2.9.1"
instead of
scalaVersion := "2.9.1.RC1"

Unresolved dependency SBT, scalariform

I am receiving this compilation error:
[warn] ::::::::::::::::::::::::::::::::::::::::::::::
[warn] :: UNRESOLVED DEPENDENCIES ::
[warn] ::::::::::::::::::::::::::::::::::::::::::::::
[warn] :: com.typesafe.sbt#sbt-scalariform;1.3.0: not found
[warn] ::::::::::::::::::::::::::::::::::::::::::::::
[warn]
[warn] Note: Some unresolved dependencies have extra attributes. Check that these dependencies exist with the requested attributes.
[warn] com.typesafe.sbt:sbt-scalariform:1.3.0 (scalaVersion=2.11, sbtVersion=0.13)
[warn]
In the root of my project I have a build.sbt file:
scalaVersion in ThisBuild := "2.11.6"
I also have a core/build.sbt file with several resolvers, libraryDependencies, and exclusions.
project/plugins.sbt:
addSbtPlugin(...)
resolvers += "Typesafe Public Repo" at "http://repo.typesafe.com/typesafe/releases"
resolvers += "JBoss Repository" at "http://repository.jboss.org/nexus/content/groups/public//"
~/.sbt/0.13/global.sbt
scalaVersion := "2.11.6"
You need to remove scalaVersion := "2.11.6" from ~/.sbt/0.13/global.sbt.
In sbt 0.13, sbt and its ecosystem of plugins is current using Scala 2.10.
The sbt-scalariform changed the groupId/organization
1.3.0 - "com.typesafe.sbt" % "sbt-scalariform" % "1.3.0"
available only for scala 2.9.1, 2.9.2 and 2.10
sbt 0.13
as seen here: https://dl.bintray.com/sbt/sbt-plugin-releases/com.typesafe.sbt/sbt-scalariform/scala_2.10/sbt_0.13/1.3.0/
1.4.0, 1.5.0, ... , 1.8.2 - "org.scalariform" % "sbt-scalariform" & "1.8.2"
https://repo1.maven.org/maven2/org/scalariform/sbt-scalariform_2.10_0.13/
https://search.maven.org/#search%7Cga%7C1%7Ca%3A%22sbt-scalariform%22

UNRESOLVED DEPENDENCIES error while trying to create jar

I'm trying to build a Scala jar file to run it in spark.
I'm following this tutorial.
when trying to build jar file using sbt as here, i'm facing with following error
[info] Resolving org.apache.spark#spark-core_2.10.4;1.0.2 ...
[warn] module not found: org.apache.spark#spark-core_2.10.4;1.0.2
[warn] ==== local: tried
[warn] /home/hduser/.ivy2/local/org.apache.spark/spark-core_2.10.4/1.0.2/ivys/ivy.xml
[warn] ==== Akka Repository: tried
[warn] http://repo.akka.io/releases/org/apache/spark/spark-core_2.10.4/1.0.2/spark-core_2.10.4-1.0.2.pom
[warn] ==== public: tried
[warn] http://repo1.maven.org/maven2/org/apache/spark/spark-core_2.10.4/1.0.2/spark-core_2.10.4-1.0.2.pom
[warn] ::::::::::::::::::::::::::::::::::::::::::::::
[warn] :: UNRESOLVED DEPENDENCIES ::
[warn] ::::::::::::::::::::::::::::::::::::::::::::::
[warn] :: org.apache.spark#spark-core_2.10.4;1.0.2: not found
[warn] ::::::::::::::::::::::::::::::::::::::::::::::
[error] {file:/home/prithvi/scala/asd/}default-d57abf/*:update: sbt.ResolveException: unresolved dependency: org.apache.spark#spark-core_2.10.4;1.0.2: not found
[error] Total time: 2 s, completed 13 Aug, 2014 5:24:24 PM
what's the issue and how to solve it.
Dependency issue has been resolved. Thank you "om-nom-nom"but new error arised
[warn] ::::::::::::::::::::::::::::::::::::::::::::::
[warn] :: FAILED DOWNLOADS ::
[warn] :: ^ see resolution messages for details ^ ::
[warn] ::::::::::::::::::::::::::::::::::::::::::::::
[warn] :: org.eclipse.jetty.orbit#javax.transaction;1.1.1.v201105210645!javax.transaction.orbit
[warn] :: org.eclipse.jetty.orbit#javax.servlet;3.0.0.v201112011016!javax.servlet.orbit
[warn] :: org.eclipse.jetty.orbit#javax.mail.glassfish;1.4.1.v201005082020!javax.mail.glassfish.orbit
[warn] :: org.eclipse.jetty.orbit#javax.activation;1.1.0.v201105071233!javax.activation.orbit
[warn] ::::::::::::::::::::::::::::::::::::::::::::::
[error] {file:/home/prithvi/scala/asd/}default-c011e4/*:update: sbt.ResolveException: download failed: org.eclipse.jetty.orbit#javax.transaction;1.1.1.v201105210645!javax.transaction.orbit
[error] download failed: org.eclipse.jetty.orbit#javax.servlet;3.0.0.v201112011016!javax.servlet.orbit
[error] download failed: org.eclipse.jetty.orbit#javax.mail.glassfish;1.4.1.v201005082020!javax.mail.glassfish.orbit
[error] download failed: org.eclipse.jetty.orbit#javax.activation;1.1.0.v201105071233!javax.activation.orbit
[error] Total time: 855 s, completed 14 Aug, 2014 12:28:33 PM
You have your dependency defined as
"org.apache.spark" %% "spark-core" % "1.0.2"
That %% instructs sbt to substitute current scala version to artifact name. Apparently, spark was build for the whole family of 2.10 scala, without specific jars for 2.10.1, 2.10.2 ...
So all you have to do is to redefine it as:
"org.apache.spark" % "spark-core_2.10" % "1.0.2"
I had the same issue.
Looks like that some bugs are in different versions/compilations/etc.
For me the following build.sbt worked fine
name := "My Project"
version := "1.0"
scalaVersion := "2.11.8"
libraryDependencies += "org.apache.spark" %% "spark-sql" % "2.3.2"
Hope it helps
spark-core_2.10.4;1.0.2 means that it is build on top of scala 2.10 vesion.
so you have to specified this scalaVersion := "2.10.4" in your build file.
Please check your .sbt file and change accordingly.
libraryDependencies ++= Seq(
"org.apache.spark" %% "spark-core" % "1.1.0",
"org.eclipse.jetty.orbit" % "javax.servlet" % "3.0.0.v201112011016",
"org.eclipse.jetty.orbit" % "javax.transaction" % "1.1.1.v201105210645",
"org.eclipse.jetty.orbit" % "javax.mail.glassfish" % "1.4.1.v201005082020"
)
How can you change the current dependencies? I mean, when you type sbt package for a build file like:
name := "Simple Project"
version := "1.0"
scalaVersion := "2.10.4"
libraryDependencies += "org.apache.spark" %% "spark-core" % "1.2.0"
SBT will start resolving and downloading all kinds of dependencies. But if you see that it is failing on a dependency that is no longer inthe maven repo, what to do? Where can you change the dpencies it tries.
#OP: The problem is that your SBT is outdated. If you downloaded it using apt, you can use apt to remove it as well. In any case, download the latest .tgz (not the .deb) and simply unpack it, after that add the /sbt/bin/ folder to your .bashrc I noticed that older SBT's (the .deb and apt-get versions) work with older scala versions. You either need to manually add or change the dependencies that the older SBT is trying to find or simply change to the latest (not sooo)SBT.

unresolved dependency: com.typesafe.play#play-slick_2.10;0.6.0.1: not found

I am getting unresolved dependencies errors when trying to use slick or play-slick with Play Framework 2.2.2, sbt 0.13.0 and Scala 2.10.3 on Mac OS X Mavericks.
[info] Updating {file:/Users/michaelrichardson/Documents/Play/glasgowEffect/}glasgoweffect...
[info] Resolving com.typesafe.play#slick_2.10;2.0.0 ...
[warn] module not found: com.typesafe.play#slick_2.10;2.0.0
[warn] ==== Typesafe Releases Repository: tried
[warn] http://repo.typesafe.com/typesafe/releases/com/typesafe/play/slick_2.10/2.0.0/slick_2.10-2.0.0.pom
[info] Resolving com.typesafe.play#play-slick_2.10;0.6.0.1 ...
[warn] module not found: com.typesafe.play#play-slick_2.10;0.6.0.1
[warn] ==== Typesafe Releases Repository: tried
[warn] http://repo.typesafe.com/typesafe/releases/com/typesafe/play/play-slick_2.10/0.6.0.1/play-slick_2.10-0.6.0.1.pom
[info] Resolving org.fusesource.jansi#jansi;1.4 ...
[warn] ::::::::::::::::::::::::::::::::::::::::::::::
[warn] :: UNRESOLVED DEPENDENCIES ::
[warn] ::::::::::::::::::::::::::::::::::::::::::::::
[warn] :: com.typesafe.play#slick_2.10;2.0.0: not found
[warn] :: com.typesafe.play#play-slick_2.10;0.6.0.1: not found
[warn] ::::::::::::::::::::::::::::::::::::::::::::::
[trace] Stack trace suppressed: run last *:update for the full output.
[error] (*:update) sbt.ResolveException: unresolved dependency: com.typesafe.play#slick_2.10;2.0.0: not found
[error] unresolved dependency: com.typesafe.play#play-slick_2.10;0.6.0.1: not found
[error] Total time: 7 s, completed Apr 27, 2014 2:58:48 PM
I have tried clearing my ivy cache, running play clean and adding different resolvers but nothing has worked.
This is the build.sbt file:
name := "Test"
version := "1.0-SNAPSHOT"
libraryDependencies ++= Seq(
jdbc,
anorm,
cache,
"com.typesafe.slick" %% "slick" % "2.0.0",
"com.typesafe.play" %% "play-slick" % "0.6.0.1"
)
play.Project.playScalaSettings
UPDATE: Looked into resolvers
[play21-osm] $ show resolvers
[info] List(Typesafe Releases Repository: http://repo.typesafe.com/typesafe/releases/, Typesafe Releases: http://typesafe.artifactoryonline.com/typesafe, pk11 repo: http://pk11-scratch.googlecode.com/svn/trunk)
[play21-osm] $ show externalResolvers
[info] ArrayBuffer(FileRepository(local,FileConfiguration(true,None),Patterns(ivyPatterns=List(${ivy.home}/local/[organisation]/[module]/(scala_[scalaVersion]/)(sbt_[sbtVersion]/)[revision]/[type]s/artifact.[ext]), artifactPatterns=List(${ivy.home}/local/[organisation]/[module]/(scala_[scalaVersion]/)(sbt_[sbtVersion]/)[revision]/[type]s/artifact.[ext]), isMavenCompatible=false)), Maven2 Local: file:/Users/mr/.m2/repository, public: http://repo1.maven.org/maven2/, Typesafe Releases Repository: http://repo.typesafe.com/typesafe/releases/, Typesafe Releases: http://typesafe.artifactoryonline.com/typesafe, pk11 repo: http://pk11-scratch.googlecode.com/svn/trunk)
Quit Play Console, and make sure your build.sbt looks like this:
name := "Test"
version := "1.0-SNAPSHOT"
libraryDependencies ++= Seq(
jdbc,
anorm,
cache,
"com.typesafe.slick" %% "slick" % "2.0.0",
"com.typesafe.play" %% "play-slick" % "0.6.0.1"
)
play.Project.playScalaSettings
Delete $PLAY_HOME/repository/cache/com.typesafe.slick and $PLAY_HOME/repository/cache/com.typesafe.play/play-slick_2.10. You may want to delete complete cache directory if you like to.
Run Play console again and execute update followed by compile.
Your slick dependency has the wrong group name. It should be com.typesafe.slick instead of com.typesafe.play:
"com.typesafe.slick" %% "slick" % "2.0.0"
Very hard to tell if this really was what fixed the problem but it is now working for me.
cd ~
brew uninstall sbt
brew uninstall play
mv .sbt .sbtold
mv .ivy2 .ivy2old
brew install sbt
brew install play
sbt
play
sbt clean
I think that my sbt or ivy repositories had become corrupted and this resulted in them being rebuilt.