我克隆了这个项目https://github.com/robohorse/RoboPOJOGenerator,并尝试在IntelliJ IDE的帮助下进行构建。
它已成功导入并下载了必要的依赖关系,但是在重建它时失败。
Error:(10, 24) java: cannot find symbol
symbol: variable DaggerAppComponent
location: class com.robohorse.robopojogenerator.injections.Injector
我尝试了许多stackoverflow线程,但对我没有用。这是带有 Gradle 或 Dagger 的东西。
buildscript {
repositories {
mavenCentral()
maven { url "http://dl.bintray.com/jetbrains/intellij-plugin-service" }
maven { url "https://plugins.gradle.org/m2/" }
maven { url "https://oss.sonatype.org/content/repositories/snapshots/" }
}
dependencies {
classpath "net.ltgt.gradle:gradle-apt-plugin:0.9"
classpath "org.jetbrains.intellij.plugins:gradle-intellij-plugin:0.2.0-SNAPSHOT"
classpath 'org.kt3k.gradle.plugin:coveralls-gradle-plugin:2.8.1'
}
}
apply plugin: "java"
apply plugin: "idea"
apply plugin: "org.jetbrains.intellij"
apply plugin: "net.ltgt.apt"
apply plugin: "jacoco"
apply plugin: 'com.github.kt3k.coveralls'
compileJava {
sourceCompatibility = 1.8
targetCompatibility = 1.8
}
jacocoTestReport {
reports {
xml.enabled = true
html.enabled = true
}
}
coveralls {
jacocoReportPath = "${buildDir}/reports/jacoco/test/jacocoTestReport.xml"
}
repositories {
mavenCentral()
}
group "com.robohorse.robopojogenerator"
version "1.8.3"
intellij {
pluginName "RoboPOJOGenerator"
intellij.updateSinceUntilBuild false
//intellij.localPath = "/Applications/IntelliJ IDEA CE.app/Contents"
}
ext.daggerVersion = '2.7'
dependencies {
testCompile "junit:junit:4.12"
testCompile 'org.mockito:mockito-core:2.0.86-beta'
compile "com.intellij:annotations:+@jar"
compile 'org.json:json:20160212'
compile 'commons-io:commons-io:2.4'
compile 'com.google.guava:guava:19.0'
compile "com.google.dagger:dagger:$daggerVersion"
apt "com.google.dagger:dagger-compiler:$daggerVersion"
compile "javax.annotation:jsr250-api:1.0"
compile 'com.fifesoft:rsyntaxtextarea:2.6.0'
}
最佳答案
**@Singleton**
@Component(modules = AppModule.class)
public interface AppComponent {
...
}
确保已为组件注释了
@Singleton
。