简体   繁体   中英

Bazel build with Jackson annotations for ser/Deser and generate Java classes

So, we have been trying to xploring bazel as a build system for our organization, since we have a huge monorepo. One of the problems I'm facing is, we have some code-gen classes which use Jackson's annotation processors to generate immutable copies of some file types.

Eg :

@JsonSerialze
@JsonInclude(JsonInclude.Include.NON_EMPTY)
@Value.Immutable
@JsonDeserialize(as=ImmutableABC.class)
Public abstract class ABC {
...
}

So, for this , I include a java_plugin tag in bazel build file for this module as follows :

Java_plugin(
        name="abcgen",
        srcs=["src/.../ABC.java"],
        Deps=[ {jackson-deps go here}],
        processor_class = "org.immutables.processor.ProxyProcessor",
)

This always fails , saying cannot find the ImmutableABC.class file which is referenced in the annotation. Any ideas? Am I missing the processor class for the Jackson annotations, and also is it possible to include multiple processor classes?

对于遇到此类问题的任何人,请确保您的插件的generates_api = 1,如果在库中使用了生成的类(对于杰克逊部分而言),那实际上不是问题

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM