How do I configure IntelliJ/gradle to use dagger 2.0

后端 未结 8 2281
野的像风
野的像风 2020-12-28 16:01

I have a gradle project and I want to use dagger 2.0 in it. I don\'t know how to configure IntelliJ and gradle to generate files and let IntelliJ find them?

My build

8条回答
  •  死守一世寂寞
    2020-12-28 16:15

    Since net.ltgt.apt version 0.11 (Feb 2018) you can just apply the plugin net.ltgt.apt-idea to build.gradle:

    plugins {
        id "net.ltgt.apt-idea" version "0.18"
    }
    
    apply plugin: 'idea'
    apply plugin: 'java'
    
    dependencies {
        compile             "com.google.dagger:dagger:2.17"
        annotationProcessor "com.google.dagger:dagger-compiler:2.17"
    }
    

提交回复
热议问题