POM dependencies not being resolved by Gradle


(Omar Aflak) #1

Hi, my name is Omar. I am encountering a problem when including my published Android library in a new project. When I include the librray :

implementation 'me.aflak.libraries:filter-annotation:1.0'
annotationProcessor 'me.aflak.libraries:filter-processor:1.0'

I get this error :

NoClassDefFoundError: com/squareup/javapoet/TypeName

If I run gradle dependencies, I have these lines among the output :

debugAnnotationProcessorClasspath - Resolved configuration for
annotation-processor for variant: debug
— me.aflak.libraries:filter-processor:1.0

Which means that the dependencies in the processor.pom file are not being resolved by gradle. And especially the JavaPoet dependency.

But if you check the previous link, you can see that JavaPoet is indeed included in the pom file.

This is the processor build.gradle :

apply plugin: 'java-library'

dependencies {
    implementation fileTree(include: ['*.jar'], dir: 'libs')
    implementation project(':filter-annotation')

    api 'com.squareup:javapoet:1.9.0'
    implementation 'com.google.code.gson:gson:2.8.1'
    implementation 'com.google.auto.service:auto-service:1.0-rc3'
}

This is the annotation build.gradle :

apply plugin: 'java-library'

dependencies {
    implementation fileTree(include: ['*.jar'], dir: 'libs')

    api 'com.google.code.gson:gson:2.8.1'
}

I’m a bit confused. Any help would be greatly appreciated ! Thanks!


(Omar Aflak) #2

Well… I only had to add mavenLocal() to the project repository.