How to declare annotation processor witch is inside of gradle module

1.4k views Asked by At

I have modules in my Android project. One of modules (moduleA for example) use another (moduleB) as a dependency:

dependencies {
    api project(':moduleB')
}

And also I still have apt and old gradle plagin. Now, I delete apt from gradle files, upgrade plugin version and get error:

Annotation processors must be explicitly declared now.  The following 
dependencies on the compile classpath are found to contain annotation 
processor.  Please add them to the annotationProcessor configuration.
  - moduleB.jar (project :moduleB)

If we use some external dependency we do like this (for example) to resolve this problem:

compile 'com.google.dagger:dagger:2.8'
annotationProcessor 'com.google.dagger:dagger-compiler:2.8'

But what I need to do with my case, when annotattion processor is inside of gradle module? Could you explain it, because I don't have deep understanding in this area and usually I simply take this lines

compile 'com.google.dagger:dagger:2.8'
annotationProcessor 'com.google.dagger:dagger-compiler:2.8'

from repository of library provider. I try to research this case, but don't find anything similar.

1

There are 1 answers

0
madhead On BEST ANSWER

project(':moduleB') is just a way to specify an inter-project dependencies, like you do with "full" coordinates (com.google.dagger:dagger:2.8). So, to use another module as an annotation processor just use

dependencies {
    …
    annotationProcessor(project(":moduleB"))
    …
}