bazel-contrib / bazel-contrib/rules_jvm_external
Annotation processor not found
- Dominant language
- Java
- Stars
- 373
- Forks
- 301
- Avg merge
- 6d 3h
- Merged PRs (30d)
- 5
Description
I added a `java_plugin` to enable support for annotation processors but it doesn't seem to work:
```
java_plugin(
name = "epoxy_plugin",
processor_class = "com.airbnb.epoxy.EpoxyProcessor",
deps = [
"@maven//:com_airbnb_android_epoxy",
"@maven//:com_airbnb_android_epoxy_annotations",
],
)
java_library(
name = "epoxy_lib",
exported_plugins = ["epoxy_plugin"],
)
```
I'm getting the following error:
```
warning: [kapt] Can't find annotation processor class com.airbnb.epoxy.EpoxyProcessor: com.airbnb.epoxy.EpoxyProcessor
src/main/java/com/matthewcheok/bazeltest/MainActivity.kt:19:17: error: unresolved reference: itemCustomView
itemCustomView {
^
src/main/java/com/matthewcheok/bazeltest/MainActivity.kt:20:21: error: unresolved reference: id
id("custom view $i")
^
src/main/java/com/matthewcheok/bazeltest/MainActivity.kt:21:21: error: expression 'title' of type 'CharSequence!' cannot be invoked as a function. The function 'invoke()' is not found
title("this is a green custom view item")
^
```
The unresolved references are likely because we're not getting the code generation expected.
The sample repo is at https://github.com/matthewcheok/bazel-epoxy-annotation-processor
Contributor guide
Research direction
Start with the java_plugin and java_library configuration in the issue and reproduce the warning using the sample repository at https://github.com/matthewcheok/bazel-epoxy-annotation-processor. Trace why com.airbnb.epoxy.EpoxyProcessor is not found through the Maven dependencies and exported_plugins setup. Done means the processor is discovered and the generated itemCustomView, id, and title references resolve.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- build-system
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 25/100