在IntelliJ中找不到符号变量DaggerAppComponent

时间:2017-08-18 15:42:34

标签: java gradle dagger-2

我克隆了这个项目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还是匕首的东西。

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'
}

1 个答案:

答案 0 :(得分:0)

public function scopeKm($query, $kmFrom, $kmTo)
    {   
        if(($kmFrom) && ($kmTo)){
            return $query->where('km','>' ,$kmFrom])->where('km','<',$kmTo);   
        }
        return $query;
    }

确保为您的组件添加**@Singleton** @Component(modules = AppModule.class) public interface AppComponent { ... } 注释。