I am having problems compiling a Java dependency loaded via GIT:
object ApplicationBuild extends Build {
lazy val project = Project("root", file(".")).dependsOn(RootProject(riakJavaClient))
lazy val riakJavaClient = uri("git://github.com/basho/riak-java-client")
}
The error I am receiving from sbt compile
is:
[info] Compiling 134 Java sources to /Users/lawrencewagerfield/.sbt/0.13/staging/da0e66c4764a467c8977/riak-java-client/target/scala-2.10/classes...
[error] /Users/lawrencewagerfield/.sbt/0.13/staging/da0e66c4764a467c8977/riak-java-client/src/main/java/com/basho/riak/client/cap/Quorum.java:22: error: unmappable character for encoding ASCII
[error] * Riak 0.12 introduced ???symbolic??? consistency options for R and W
SBT seems to be executing javac
with an encoding that is incompatible with the source files in this dependency.
I have tried adding the following to build.sbt
, but it is having no effect (error is the same):
javacOptions ++= Seq("-encoding", "UTF-16") // Note: I have tried with UTF-8 too
Does the above only apply to source files within my project? Any idea how to get pass this issue?
TL;DR How do I get my Java dependencies compiling with the correct encoding?
You are correct that the setting only applies to source files in your project. If the project part of the scope isn't specified, which is typical, it defaults to the enclosing project. To have a setting apply to another project, scope it to that project. For example,
javacOptions in riakJavaClient ++= Seq("-encoding", "UTF-8")
You can verify that your options are being used with last
. For example,
sbt> last compile
To run commands like the above on a project from git, change to it using project
(see help project
for details).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With