Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why IntelliJ can't find SBT snapshot dependencies?

I have a Play 2.3 Scala project which runs perfectly when started with the activator run command. However, if I try to start it in IntelliJ 13 from the Run/Debug Configurations option there's a problem with resolving snapshot dependencies.

According to logs following repositories has been checked in order to find dependencies:

[warn]  module not found: org.package#my-dep;1.0-SNAPSHOT
[warn] ==== local: tried
[warn]   C:\Users\MyUser\.ivy2\local\org.package\my-dep\1.0-SNAPSHOT\ivys\ivy.xml
[warn] ==== public: tried
[warn]   http://repo1.maven.org/maven2/org/package/my-dep/1.0-SNAPSHOT/my-dep-1.0-SNAPSHOT.pom
[warn] ==== Typesafe Releases Repository: tried
[warn]   http://repo.typesafe.com/typesafe/releases/org/package/my-dep/1.0-SNAPSHOT/my-dep-1.0-SNAPSHOT.pom

Dependencies are present at my ~/.ivy2/cache directory. I also have there other dependencies which aren't marked as snapshots and it looks like IntelliJ doesn't have a problem with finding them. It only applies to snapshots.

Update

It looks like IDEA ignores my ~/.sbt/repositories file where snapshot repository is defined and uses default SBT plugin configuration.

Is it actually possible to configure IDEA so it would use my custom repository definition?

like image 284
Daniel Olszewski Avatar asked Oct 20 '22 22:10

Daniel Olszewski


1 Answers

I tried without success to set custom sbt-launcher in Settings -> SBT -> Launcher -> Custom.

enter image description here

After I run my application with Run configuration I could see in the logs that for some reason launcher that I specified was overridden by another which was part of the Scala plugin.

-Dsbt.global.base=C:\Users\User\AppData\Local\Temp\sbt-global-plugin3401565420094215394stub -classpath C:\Users\User\.IntelliJIdea13\config\plugins\Scala\launcher\sbt-launch.jar

Finally I managed to force IDEA to use my ~/.sbt/repositories by adding -Dsbt.repository.config=C:\Users\User\.sbt\repositories to the Run Configuration JVM Options.

enter image description here

I have also set -Dsbt.override.build.repos=true to make sure that only repositories listed in my custom configuration are used.

like image 145
Daniel Olszewski Avatar answered Oct 22 '22 23:10

Daniel Olszewski