找不到更多类型 class

MoreTypes class not found

我有一个使用 dagger-2 和 grpc 的 java 项目,当我尝试使用 ./gradlew build 构建它时,出现以下错误:

> java.lang.NoClassDefFoundError: com/google/auto/common/MoreTypes

是否应该在 dagger-2 依赖项内提供 MoreTypes,或者我应该在 class 路径上提供该依赖项?

这是gradle.build文件内容的相关部分:

plugins {
    id "net.ltgt.apt" version "0.10"
    id "com.google.protobuf" version "0.8.1"
    id "java"
}

dependencies {
    compile 'io.grpc:grpc-all:1.5.0'

    compile 'com.google.dagger:dagger:2.14'
    apt 'com.google.dagger:dagger-compiler:2.14'

    testApt 'com.google.dagger:dagger-compiler:2.14'

   }



apply plugin: 'java'

sourceCompatibility = 1.8
targetCompatibility = 1.8

这是 Dagger 2.14 中的一个问题,已在 2.14.1 中修复。请参阅 issue 994、“Dagger 2.14 中断构建”:

I have not isolated the issue to a small sample project at this point, but a possible cause I see is below, maybe that gives a pointer. I don't have any explicit dependency on Google Auto libs in that part of the build.

java.lang.NoClassDefFoundError: com/google/auto/common/MoreTypes

已确认在 2.14.1 中修复,其中包含 this commit