|
JavaSources
sbt has movedsbt has now completely moved to GitHub. See https://github.com/harrah/xsbt/wiki/Java-Sources. Java SourcesDescriptionsbt has support for compiling Java sources in sbt with the following limitations:
Usage
Pass options to the Java compiler by adding instances of JavaCompileOption to your compileOptions. For example: override def compileOptions = javaCompileOptions("-g:none") ++ super.compileOptions.toListAs with options for the Scala compiler, the arguments are not parsed by sbt. Multi-element options, such as -source 1.5, are specified like: override def javaCompileOptions = super.javaCompileOptions ++
javaCompileOptions("-source", "1.5")You can specify the order in which Scala and Java sources are built with the compileOrder method. Possible values are from the CompileOrder enumeration: Mixed, JavaThenScala, and ScalaThenJava. If you have circular dependencies between Scala and Java sources, you need the default, Mixed, which passes both Java and Scala sources to scalac and then compiles the Java sources with javac. If you do not have circular dependencies, you can use one of the other two options to speed up your build by not passing the Java sources to scalac. For example, if your Scala sources depend on your Java sources, but your Java sources do not depend on your Scala sources, you can do: override def compileOrder = CompileOrder.JavaThenScala | |
override def buildOrder = BuildOrder?.JavaThenScala?
does not work with 0.5.2, by looking at the source in trunk it was changed to:
override def compileOrder = CompileOrder?.JavaThenScala?
Thanks for the correction!
-Mark
In 0.5.2, we found that the compile option doesn't seem to like spaces (which some java options use), but the list respects ordering. Therefore to set the argument "-source 1.5" we had to use two options:
override def javaCompileOptions = JavaCompileOption?("-source") :: JavaCompileOption?("1.5") :: super.compileOptions.toList
Does the clarification help?
Thanks, Mark
Ah yes, the clarification is helpful. Maybe the scaladoc is good for that kind of detail, but maybe that's just how I roll. :) Thanks! -T