bazel: ijar does not work with scala jars that contain macros
I get:
Exception in thread "main" java.lang.ClassFormatError: Absent Code attribute in method that is not native or abstract in class file com/twitter/
scalding/serialization/macros/impl/OrderedSerializationProviderImpl$
when compiling against an ijar’ed file that contains macros.
maybe this is not easily solvable, since I guess the scala compiler has to run methods in the jars at compile time. It would be good to see if there is a way we can tell a method is a macro method, and if it is, it should not be removed by ijar.
About this issue
- Original URL
- State: closed
- Created 9 years ago
- Comments: 65 (52 by maintainers)
java_import
is the recommended bazel way for java jars that are local. But that is a java rule which forces the use of ijar by the time the scala rules can see it (currently, maybe a future change to the skylark interface of the java rules would change that).@softprops to work around, you should use a filegroup:
@sgowroji it would be nice if we could mark things closed but not completed. This definitely was not completed. I think it is more of a WONTFIX situation if I’m not mistaken.
@sixolet I assume you are using the scala rules here: https://github.com/bazelbuild/rules_scala
in that case, you can use the
/jar:file
target of amaven_jar
rather than the/jar
target. for instance: https://github.com/johnynek/bazel-deps/blob/master/3rdparty/workspace.bzl#L48