Javapoet not found in processor

1.6k views Asked by At

I created an Android library that uses JavaPoet to generate classes. It works well on my local workspace ; even if I include the library module into another project.

Now I'm trying to put my project online through bintray. The project is uploaded correctly, but then when I include it in a new project and build the projet I get this message :

Error:Bad service configuration file, or exception thrown while constructing Processor object: javax.annotation.processing.Processor: Provider me.aflak.filter_processor.FilterProcessor could not be instantiated: java.lang.NoClassDefFoundError: com/squareup/javapoet/TypeName

I guess it comes from the way I manage the dependencies... Compiletime, Runtime stuff...

This is processor build.gradle :

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

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

This is annotation buid.gradle :

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

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

This is how I include the library in an empty project :

// build.gradle project
repositories {
    maven{
        url 'https://dl.bintray.com/omaflak/maven'
    }
}

// build.gradle module
dependencies {
    compile 'me.aflak.libraries:filter-annotation:1.0'
    annotationProcessor 'me.aflak.libraries:filter-processor:1.0'
}

Could someone point me out to the right direction ? Thanks !

1

There are 1 answers

2
Omar Aflak On BEST ANSWER

I finally got the solution (a bit randomly though :p).

I had to add mavenLocal() in the library module.