Я пытаюсь перейти с maven на bazel.У меня странное поведение с java_library (и процессор аннотаций):
У меня есть подкаталог, где находится файл BUILD.
Что-то вроде appdirect-sms-gateway / appdirect-sms-gateway-settings-impl / BUILD:
java_library(
name = "appdirect_sms_gateway_settings_impl",
srcs = glob(["src/main/java/**/*.java"]),
deps = [
":mysema_query",
…
],
)
java_plugin(
name = "mysema_query_plugin",
processor_class = "com.mysema.query.apt.jpa.JPAAnnotationProcessor",
deps = [
"@guava_jar//jar",
"@javax_inject_jar//jar",
"@javax_persistence_jar//jar",
"@mysema_codegen_jar//jar",
"@querydsl_apt_jar//jar",
"@querydsl_codegen_jar//jar",
"@querydsl_core_jar//jar",
],
)
java_library(
name = "mysema_query",
exported_plugins = [":mysema_query_plugin"],
exports = [
"@guava_jar//jar",
"@javax_inject_jar//jar",
"@javax_persistence_jar//jar",
"@mysema_codegen_jar//jar",
"@querydsl_apt_jar//jar",
"@querydsl_codegen_jar//jar",
"@querydsl_core_jar//jar",
],
)
Когда я его компилирую, он работает нормально, т.е.
bazel build -s //appdirect-sms-gateway/appdirect-sms-gateway-settings-impl:appdirect_sms_gateway_settings_impl
Но когда я использую «глобальный» файл BUILD:
/ BUILD:
java_library(
name = "appdirect-parent",
srcs = glob(["*.java"]),
deps = [
…
"appdirect-sms-gateway/appdirect-sms-gateway-settings-impl:appdirect_sms_gateway_settings_impl",
],
)
Сбой:
$ bazel build --jobs 1 -s //:all
INFO: Analysed 238 targets (0 packages loaded).
INFO: Found 238 targets...
SUBCOMMAND: # //appdirect-sms-gateway/appdirect-sms-gateway-settings-impl:appdirect_sms_gateway_settings_impl [action 'Compiling Java headers appdirect-sms-gateway/appdirect-sms-gateway-settings-impl/libappdirect_sms_gateway_settings_impl-hjar.jar (8 files) and running
annotation processors (AnnotationProcessorHider$AnnotationProcessor)']
(cd /private/var/tmp/_bazel_nicolas.zin/a2e37cae9143f2d5cb81548a1629daf9/execroot/__main__ && \
exec env - \
LC_CTYPE=en_US.UTF-8 \
external/local_jdk/bin/java -Xverify:none -Xbootclasspath/p:external/bazel_tools/third_party/java/jdk/langtools/javac-9+181-r4173-1.jar -jar external/bazel_tools/tools/jdk/turbine_deploy.jar @bazel-out/darwin-fastbuild/bin/appdirect-sms-gateway/appdirect-sms-gateway-settings-impl/libappdirect_sms_gateway_settings_impl-hjar.jar-2.params)
ERROR: /Users/nicolas.zin/Documents/git/AppDirect.bazel/appdirect-parent/appdirect-sms-gateway/appdirect-sms-gateway-settings-impl/BUILD:5:1: Compiling Java headers appdirect-sms-gateway/appdirect-sms-gateway-settings-impl/libappdirect_sms_gateway_settings_impl-hjar.jar
(8 files) and running annotation processors
(AnnotationProcessorHider$AnnotationProcessor) failed (Exit 1)
appdirect-sms-gateway/appdirect-sms-gateway-settings-impl/src/main/java/com/appdirect/backend/sms/gateway/settings/dao/SmsGatewaySettingsDAOImpl.java:6: error: cannot find symbol
symbol: class QSmsGatewaySettings
location: package com.appdirect.backend.sms.gateway.settings
appdirect-sms-gateway/appdirect-sms-gateway-settings-impl/src/main/java/com/appdirect/backend/sms/gateway/settings/dao/SmsGatewaySettingsDAOImpl.java:12: error: cannot find symbol
symbol: class QSmsGatewaySettings
location: class com.appdirect.backend.sms.gateway.settings.dao.SmsGatewaySettingsDAOImpl
INFO: Elapsed time: 2.172s, Critical Path: 1.71s
INFO: 0 processes.
FAILED: Build did NOT complete successfully
QSmsGatewaySettings - это класс, сгенерированный плагином аннотации к sema
Это похоже на bazel-Файл out / darwin-fastbuild / bin / appdirect-sms-gateway / appdirect-sms-gateway-settings-impl / libappdirect_sms_gateway_settings_impl-gensrc.jar не учитывается
Кто-то сталкивался с такой же проблемой?Есть идеи, что я делаю не так?
С уважением,