How do I build a mixed java/scala project which uses java annotation code generation?

419 views Asked by At

I am creating a mixed scala + java project where the java code uses java annotations for java code generation.

The java code generation is a requirement of the library I am using (truffle)

I have created both an sbt and mill project with separate modules for the java and scala, but when the java is compiled, both build tools produce the following warning:

[warn] Could not determine source for class ...

I'm fairly sure this is because both tools use zinc for incremental compilation and zinc can not see who is generating the java files.

Is there are way to add hints to the java source files that use annotations to generate code so that zinc can understand the dependencies?

I am also open to other suggestions about how to structure a mixed java/scala project that uses java code generation using annotations.

1

There are 1 answers

1
Thomas Rynne On BEST ANSWER

The best solution I have found is to use a maven build which supports the java annotation code generation and also supports scala. Maven is an unusual choice for a scala project but seems like a necessary compromise if annotation based code generation is used. It also has good intelij support.