Resources in Scala Cross-Project

278 views Asked by At

I tried to use a file for a Unit test in a shared Module (https://github.com/portable-scala/sbt-crossproject)

I tried it in src/test/resources and src/main/resources

The resource was not copied to the .jvm/target/classes nor .jvm/target/test-classes

Is it not possible at all to use Resources in a shared Module or does it need a special configuration in sbt?

2

There are 2 answers

0
pme On BEST ANSWER

With the idea of francoisr I found a workable solution.

What I did was to put the resources here:

shared/.jvm/src/test/resources/ which is used by sbt for the sharedJVM module.

Now this runs all the tests correctly:

sbt sharedJVM/test

0
francoisr On

Resources are JVM specific, and so are not supported on the JS side without using some tricks. For more on this, see this answer by Scala.js' creator.