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

前端 未结 8 938
抹茶落季
抹茶落季 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条回答
  •  -上瘾入骨i
    2020-12-14 16:50

    Using IntelliJ IDEA 2019.1 and Gradle 5.4.1, this seems to be enough:

    plugins {
        id 'java'
    }
    
    version '1.0-SNAPSHOT'
    
    sourceCompatibility = 1.8
    
    repositories {
        mavenCentral()
    }
    
    dependencies {
        testImplementation group: 'junit', name: 'junit', version: '4.12'
    
        implementation 'com.google.dagger:dagger:2.23.1'
        annotationProcessor 'com.google.dagger:dagger-compiler:2.23.1'
    }
    

    I don't know the minimal versions for which this solution works, though.

提交回复
热议问题