I have an old Scala 2.11 project where one of the libraries for Scala.js is not available any more. It's a multiproject build so, I created a lib folder inside of my Scala js project and in the settings of that project set:
unmanagedBase := baseDirectory.value / "lib"
When I go in the SBT shell to js project and type: unmanagedBase it shows correct path to the lib folder. But when I try to import the project in Intellij I'm getting this error:
[warn] :: com.mediamath#scala-json_2.11;1.1: not found
[warn] ::::::::::::::::::::::::::::::::::::::::::::::
[warn]
[warn] Note: Unresolved dependencies path:
[warn] com.mediamath:scala-json_2.11:1.1 (/home/my_project/pg/build.sbt#L59)
[warn] +- js:js_sjs0.6_2.11:0.1-SNAPSHOT
[trace] Stack trace suppressed: run 'last js/*:ssExtractDependencies' for the full output.
[trace] Stack trace suppressed: run 'last js/*:update' for the full output.
[error] (js/*:ssExtractDependencies) sbt.ResolveException: unresolved dependency: com.mediamath#scala-json_2.11;1.1: not found
[error] (js/*:update) sbt.ResolveException: unresolved dependency: com.mediamath#scala-json_2.11;1.1: not found
And I have scala-json_2.11-1.1.jar in my lib folder
This warning
[warn] Note: Unresolved dependencies path:
[warn] com.mediamath:scala-json_2.11:1.1 (/home/my_project/pg/build.sbt#L59)
[warn] +- js:js_sjs0.6_2.11:0.1-SNAPSHOT
suggest that the actual issue that requires js:js_sjs0.6_2.11:0.1-SNAPSHOT, so some dependency related to Scala.js 0.6, while you provided scala-json_2.11-1.1.jar, a JAR dedicated for Scala.js 1.1.
Since you added a JAR as unmanaged, resolvers cannot perform evictions or suggest incompatibilities, and can merely verify whether dependencies are there or not, so you'd have to resolve them on your own.
You have some options like editing the MANIFEST file (if code would happen to be compatible between versions), or (if it's open source) compile the offending library yourself for Scala.js 1.1.
Related
I'm trying to use this code in the link bellow : https://github.com/dmiszkiewicz/sendgrid-scala but i can't download dependency org.miszkiewicz#sendgrid-scala_2.12;0.2-SNAPSHOT, i get this error:
::::::::::::::::::::::::::::::::::::::::::::::
[warn] :: UNRESOLVED DEPENDENCIES ::
[warn] ::::::::::::::::::::::::::::::::::::::::::::::
[warn] :: org.miszkiewicz#sendgrid-scala_2.12;0.2-SNAPSHOT: not found
[warn] ::::::::::::::::::::::::::::::::::::::::::::::
[warn]
[warn] Note: Unresolved dependencies path:
[warn] org.miszkiewicz:sendgrid-scala_2.12:0.2-SNAPSHOT (/Users/aicha/Projets/data-providers/project/FruitionDataProvidersBuild.scala#L62)
[warn] +- com.fruitionsciences:sendgrid-mailer_2.12:0.1
[trace] Stack trace suppressed: run 'last sendgrid-mailer/*:update' for the full output.
[trace] Stack trace suppressed: run 'last sendgrid-mailer/*:ssExtractDependencies' for the full output.
[error] (sendgrid-mailer/*:update) sbt.ResolveException: unresolved dependency: org.miszkiewicz#sendgrid-scala_2.12;0.2-SNAPSHOT: not found
[error] (sendgrid-mailer/*:ssExtractDependencies) sbt.ResolveException: unresolved dependency: org.miszkiewicz#sendgrid-scala_2.12;0.2-SNAPSHOT: not found
i'm working with scala 2.12, Does anybody have an idea
You should use Scala 2.11 to use this dependency from Sonatype repo. As you may see here, there is build of sendgrid only for Scala 2.11 in Sonatype repo, not for Scala 2.12.
Or maybe, it will be better for you to just use sendgrid-java.
I am trying to build simple hello world SBT-Scala project using IntelliJ.
When I tried to created the project for the first time, after installing the scala/ SBT plugins, I am getting the following error:
Error:Error while importing SBT project:<br/>...<br/><pre>[info] Resolving org.scala-lang#scala-reflect;2.11.8 ...
[info] Resolving org.scala-lang#scala-reflect;2.11.8 ...
[info] Resolving org.scala-lang.modules#scala-xml_2.11;1.0.4 ...
[info] Resolving org.scala-lang.modules#scala-parser-combinators_2.11;1.0.4 ...
[info] Resolving jline#jline;2.12.1 ...
[warn] ::::::::::::::::::::::::::::::::::::::::::::::
[warn] :: UNRESOLVED DEPENDENCIES ::
[warn] ::::::::::::::::::::::::::::::::::::::::::::::
[warn] :: org.scala-lang#scala-reflect;2.11.8: org.scala-lang#scala-reflect;2.11.8!scala-reflect.pom(pom.original) origin location must be absolute: file:/root/.m2/repository/org/scala-lang/scala-reflect/2.11.8/scala-reflect-2.11.8.pom
[warn] ::::::::::::::::::::::::::::::::::::::::::::::
[warn]
[warn] Note: Unresolved dependencies path:
[warn] org.scala-lang:scala-reflect:2.11.8
[warn] +- org.scala-lang:scala-compiler:2.11.8
[warn] +- default:supersimplerootscalasbt3_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: org.scala-lang#scala-reflect;2.11.8: org.scala-lang#scala-reflect;2.11.8!scala-reflect.pom(pom.original) origin location must be absolute: file:/root/.m2/repository/org/scala-lang/scala-reflect/2.11.8/scala-reflect-2.11.8.pom
[error] (*:update) sbt.ResolveException: unresolved dependency: org.scala-lang#scala-reflect;2.11.8: org.scala-lang#scala-reflect;2.11.8!scala-reflect.pom(pom.original) origin location must be absolute: file:/root/.m2/repository/org/scala-lang/scala-reflect/2.11.8/scala-reflect-2.11.8.pom
[error] Total time: 3 s, completed 22 May, 2017 4:42:05 PM</pre><br/>See complete log in file:/root/.IdeaIC2017.1/system/log/sbt.last.log
Any idea how to solve the origin location must be absolute error in this?
[Kindly note that I am able to find the file scala-reflect-2.11.8.pom unlike the error specifies: file:/root/.m2/repository/org/scala-lang/scala-reflect/2.11.8/scala-reflect-2.11.8.pom]
My build.sbt file:
name := "SuperSimpleRootScalaSBT4"
version := "1.0"
scalaVersion := "2.11.8"
My sbt version is 0.13.15.
For me deleting my ~/.ivy2 helped
Deleting ~/.ivy2 works, but not the best option, then you have to download all the cache again. Rather delete the particular directory from cache where you are facing issue.
In your case, it should be ~/.ivy2/cache/scala.lang and rebuild
i was facing the same issue:
instead of of deleting the .ivy folder, just back it up (rename the folder .ivy2 as .ivy2.backup in instance), then test again eg
$ sbt new scala/hello-world.g8
the project should be created and set up correctly now
For me helped when I granted permissions for full Maven repo:
chmod -R 755 /Users/<your_user>/.m2/
Deleting the specific dependency from ~/.ivy2/ worked for me. At times it is not a good idea to remove all dependencies as it takes long time to get them back onto the machine.
I have a scala project which is build using sbt. I want to import another project, which is also build using sbt, and which is local on my machine.
My project structure looks like this:
my-project/build.sbt
my-project/external-project/
my-project/external-project/build.sbt
my-project/external-project/...
my-project/src/test
my-project/src/main
my-project/...
my build.sbt looks like this:
lazy val root = Project("my-project", file("."))
.dependsOn(RootProject(file("./external-project/")))
.settings(
...
)
and this is what sbt "compile" gives me
[warn] Binary version (2.11) for dependency org.scala-lang#scala-library;2.11.8
[warn] in my-project#my-project_2.10;0.1-SNAPSHOT differs from Scala binary version in project (2.10).
[info] Resolving externalproject#externalproject.10;0.1 ...
[warn] module not found: externalproject#externalproject.10;0.1
[warn] ==== local: tried
[warn] /home/martin/.ivy2/local/externalproject/externalproject_2.10/0.1/ivys/ivy.xml
[warn] ==== public: tried
[warn] https://repo1.maven.org/maven2/externalproject/externalproject_2.10/0.1/externalproject_2.10-0.1.pom
[info] Resolving com.github.scopt#scopt_2.11;3.5.0 ...
[warn] ::::::::::::::::::::::::::::::::::::::::::::::
[warn] :: UNRESOLVED DEPENDENCIES ::
[warn] ::::::::::::::::::::::::::::::::::::::::::::::
[warn] :: externalproject#externalproject_2.10;0.1: not found
[warn] ::::::::::::::::::::::::::::::::::::::::::::::
[warn]
[warn] Note: Unresolved dependencies path:
[warn] externalproject:externalproject_2.10:0.1
[warn] +- my-project:my-project_2.10:0.1-SNAPSHOT
The external project is a git submodule. Neither projects uses Maven in any way.
I just want the files in my-project to be able to import the scala files in external-project, but I can't get it to work. What am I doing wrong? Do I need to restrcture my project?
You haven't specified the scalaVersion for the current project, and it defaults to 2.10. For your external project you have specified some scalaVersion from the 2.11 series. You can see this in the artifact's name: externalproject_2.10, where the _2.10 suffix stands for the Scala version the artifact was built with. Your external project doesn't provide an artifact for Scala 2.10, hence this error. Since Scala major releases are not binary compatible, you can't combine them dependency-wise.
To fix this, specify the Scala version in your build.sbt: scalaVersion := "2.11.8".
Scala 2.10.2 and SBT 0.13
I'm trying to use the np plugin and added the following lines to ../0.13/np.sbt:
seq(npSettings:_*)
(NpKeys.defaults in (Compile, NpKeys.np)) ~= {
_.copy(org="me.lessis", version="0.1.0-SNAPSHOT")
}
and this to <home-directory>/.sbt/plugins.sbt
addSbtPlugin("me.lessis" % "np" % "0.2.0")
resolvers += Resolver.url("sbt-plugin-releases",url("http://scalasbt.artifactoryonline.com/scalasbt/sbt-plugin-releases/"))(Resolver.ivyStylePatterns)
When I execute sbt run I am getting :
[info] Updating {file:/home/Projects/helloSbt/}default-310e5b...
[info] Resolving me.lessis#np;0.2.0 ...
[warn] module not found: me.lessis#np;0.2.0
[warn] ==== local: tried
[warn] /home/.ivy2/local/me.lessis/np/scala_2.10/sbt_0.12/0.2.0/ivys/ivy.xml
[warn] ==== sbt-plugin-releases: tried
[warn] http://scalasbt.artifactoryonline.com/scalasbt/sbt-plugin-releases/me.lessis/np/scala_2.10/sbt_0.12/0.2.0/ivys/ivy.xml
[warn] ==== public: tried
[warn] http://repo1.maven.org/maven2/me/lessis/np_2.10_0.12/0.2.0/np-0.2.0.pom
[warn] ::::::::::::::::::::::::::::::::::::::::::::::
[warn] :: UNRESOLVED DEPENDENCIES ::
[warn] ::::::::::::::::::::::::::::::::::::::::::::::
[warn] :: me.lessis#np;0.2.0: not found
[warn] ::::::::::::::::::::::::::::::::::::::::::::::
[warn]
[warn] Note: Some unresolved dependencies have extra attributes. Check that these dependencies exist with the requested attributes.
[warn] me.lessis:np:0.2.0 (sbtVersion=0.12, scalaVersion=2.10)
[warn]
[trace] Stack trace suppressed: run last *:update for the full output.
[error] (*:update) sbt.ResolveException: unresolved dependency: me.lessis#np;0.2.0: not found
[error] Total time: 3 s, completed Feb 6, 2014 9:23:17 AM
What am I doing wrong ?
For scala 2.10 you have to use sbt 0.13. I tried with sbt 0.13
Open in browser link:
http://dl.bintray.com/sbt/sbt-plugin-releases/me.lessis/np/scala_2.10/
There is only:
sbt_0.13/
For scala 2.9.2 you need to use sbt 0.12
==========================
Update:
Remove global configuration from $HOME/.sbt (plugins.sbt). or make or action from fresh user account (new user never used sbt)
Create empty directory test
Go to test
Create directory project
Go to project
Create plugins.sbt with content as above in question
Go to test directory
run sbt test or other command
see output - me.lessis#np;0.2.0 should be downloaded
Use .sbt/0.13/plugins/plugins.sbt (note the 0.13/plugins in the path) or even better for quick scan of the plugins installed, use .sbt/0.13/plugins/np.sbt so it's clear from the file name(s) about the plugins.
Please also note that from the question it appears that you're using SBT 0.12:
me.lessis:np:0.2.0 (sbtVersion=0.12, scalaVersion=2.10)
Add project/build.properties under helloSbt with the following line to have 0.13 be in use:
sbt.version=0.13.1
I'm trying to use this fake http server project in a sbt 0.11.0 based project. Unfortunately one of it's dependencies is giving the following error:
[error] public: bad organisation found in http://repo1.maven.org/maven2/org/apache/commons/commons-io/1.3.2/commons-io-1.3.2.pom: expected='org.apache.commons' found='commons-io'
[warn] ::::::::::::::::::::::::::::::::::::::::::::::
[warn] :: UNRESOLVED DEPENDENCIES ::
[warn] ::::::::::::::::::::::::::::::::::::::::::::::
[warn] :: org.apache.commons#commons-io;1.3.2: java.text.ParseException: inconsistent module descriptor file found in 'http://repo1.maven.org/maven2/org/apache/commons/commons-io/1.3.2/commons-io-1.3.2.pom': bad organisation: expected='org.apache.commons' found='commons-io';
[warn] ::::::::::::::::::::::::::::::::::::::::::::::
[error] {file:/home/project_location/}default-db401d/*:update: sbt.ResolveException: unresolved dependency: org.apache.commons#commons-io;1.3.2: java.text.ParseException: inconsistent module descriptor file found in 'http://repo1.maven.org/maven2/org/apache/commons/commons-io/1.3.2/commons-io-1.3.2.pom': bad organisation: expected='org.apache.commons' found='commons-io';
From what I can tell this can be worked around by asking that ivy not check the consistency of the pom files (Maven has this setting off by default). I can't work out how to turn this off in sbt though. I tried
ivyValidate := false
but this has no effect.
Am I on the right track with this setting and is it possible to turn this setting off?
You could try to exclude this dependency and include it manually :
"se.dannej" % "fakehttpserver" % "0.1.0" exclude("org.apache.commons", "commons-io")
"commons-io" % "commons-io" % "another version"
or even download the commons-io jar and push it in your lib directory.