[英]How to use gradle BoM with annotation processor?
I'm trying to define all my dependencies in a bill of materials (BoM) platform module so the other modules in my multi-module project can use the same versions.我正在尝试在物料清单 (BoM) 平台模块中定义所有依赖项,以便我的多模块项目中的其他模块可以使用相同的版本。 All works fine except the kapt dependencies.
除了 kapt 依赖项外,一切正常。 In those I get this error:
在那些我得到这个错误:
Could not determine the dependencies of task ':app:kaptDebugKotlin'.
> Could not resolve all task dependencies for configuration ':app:kapt'.
> Could not find com.google.dagger:dagger-compiler:.
Required by:
project :app
For example with this platform ( :bom
) module:例如使用这个平台(
:bom
)模块:
plugins {
id 'java-platform'
}
dependencies {
constraints {
api 'com.google.dagger:dagger:2.25.2'
api 'com.google.dagger:dagger-compiler:2.25.2'
}
}
I'm getting that error when I use it like this in the app module:当我在应用程序模块中像这样使用它时,我收到了该错误:
dependencies {
implementation platform(project(':bom'))
implementation 'com.google.dagger:dagger'
kapt 'com.google.dagger:dagger-compiler'
// ...
}
I'm getting the same error if I use annotationProcessor
.如果我使用
annotationProcessor
我会遇到同样的错误。 If I set the version like kapt 'com.google.dagger:dagger-compiler:2.25.2'
all works.如果我将版本设置为
kapt 'com.google.dagger:dagger-compiler:2.25.2'
一切正常。
What am I doing wrong?我究竟做错了什么? Can I use BoM for
kapt
or annotationProcessor
?我可以将 BoM 用于
kapt
或annotationProcessor
吗?
you are missing kapt platform(project(':bom'))
你缺少
kapt platform(project(':bom'))
kapt doesn't include dependencies from implementation, so it doesn't include the platform either kapt 不包含来自实现的依赖项,因此它也不包含平台
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.