Pergunta

For our Scala development we currently use ivy + ant, but we are also trying to use sbt for our development workflow. This would be for the continuous incremental compilation when not using an IDE.

sbt uses ivy, so in theory this should work. But when using an ivy external file the tests won't compile.

To reproduce this you can even use the generated ivy.xml file from any sbt project.

Here are the steps to reproduce the error on a sbt project with tests,

  • from the sbt console run deliverLocal (deliver-local in previous versions of sbt)
  • copy the generated ivy file into your project home and rename it to 'ivy.xml'. From my understanding using this file should be equivalent to declaring the dependencies in build.sbt.
  • edit the build.sbt, add externalIvyFile() on one line and then comment all dependencies declarations
  • in the console, run reload, then test

compile will run just fine, but test will fail at compile time. None of the dependencies will be honoured, not even the production code of the current project.

What am I missing?

Foi útil?

Solução

In my case it worked with the following build.sbt:

externalIvyFile()

classpathConfiguration in Compile := Compile

classpathConfiguration in Test := Test

classpathConfiguration in Runtime := Runtime

You just need the extra three lines in the end. Here is a link for more info: http://www.scala-sbt.org/release/docs/Detailed-Topics/Library-Management.html#ivy-file-dependency-configuration

Look for the Full Ivy Example. I hope it helps!

EDIT: Just to be complete - here is what pointed me to the above link: https://github.com/sbt/sbt/issues/849.

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top