Is there any way of making IntelliJ IDEA recognizing Dagger 2 generated classes in a Java project?

前端 未结 8 958
抹茶落季
抹茶落季 2020-12-14 16:21

Context

I have started a personal project in java with Gradle as the build system and I want to use Dagger 2 as a DI. The main reason o

8条回答
  •  情话喂你
    2020-12-14 16:33

    Finally I made it!

    I had to add the apt and the idea plugin so right now my build.gradle file look like this:

    buildscript {
        repositories {
            maven {
                url "https://plugins.gradle.org/m2/"
            }
        }
        dependencies {
            classpath "net.ltgt.gradle:gradle-apt-plugin:0.4"
        }
    }
    
    apply plugin: "net.ltgt.apt"
    apply plugin: 'java'
    apply plugin: 'idea'
    
    repositories {
        mavenCentral()
    }
    
    dependencies {
        testCompile group: 'junit', name: 'junit', version: '4.12'
    
        compile 'com.google.dagger:dagger:2.0.1'
        apt 'com.google.dagger:dagger-compiler:2.0.1'
    }
    

提交回复
热议问题