How to make an sbt project reference external java sources
Could anyone post a code example of how to reference an external java source d开发者_如何转开发irectory in an sbt project?
If I do the following
override def mainSourceRoots = super.mainSourceRoots +++ externalsourcepath
the sbt compile task will properly find and compile the java sources but then fail. e.g.
[info] Compilation successful.
java.lang.RuntimeException: Path /full/path/to/java/class/com/foo/bar/SomeClass.java not in .
SBT 0.9 will support external sub-projects. Until then, I would suggest to build the other one to a JAR, and drop the results into ./lib
.
If the Java projects use Maven or Ivy you can probably install them locally and declare them as dependencies in the SBT project. If you need something like Maven's reactor where you can mix Java and Scala submodules within the same super project, and compile them in order at the same time, you can try SBT Subprojects
精彩评论