Getting error: Annotation processor 'io.vertx.codegen.CodeGenProcessor' not found

306 views
Skip to first unread message

rj.bh...@gmail.com

unread,
Feb 1, 2019, 8:39:14 AM2/1/19
to vert.x
Hi have upgraded gradle to 5.1.1 version in my java project.
I have 1 task for annotation processing in my build.gradle. 

task annotationProcessing(type: JavaCompile, group: 'build') { // codegen
source = sourceSets.main.java
classpath = configurations.compile + configurations.compileOnly
destinationDir = project.file('src/main/generated')
options.compilerArgs = [
"-proc:only",
"-processor", "io.vertx.codegen.CodeGenProcessor",
"-Acodegen.output=${project.projectDir}/src/main"
]
}
dependencies {
// The production code uses the SLF4J logging API at compile time
compile 'io.vertx:vertx-core:' + project.getProperty("vertx.core.version")
compile 'io.vertx:vertx-web:' + project.getProperty("vertx.web.version")
compile 'io.vertx:vertx-dropwizard-metrics:' + project.getProperty("vertx.dropwizard.metrics.version")
compile 'io.vertx:vertx-service-proxy:' + project.getProperty("vertx.service.proxy.version")
compile 'io.vertx:vertx-codegen:' + project.getProperty("vertx.codegen.version")
compile 'io.prometheus:simpleclient_vertx:' + project.getProperty("prometheus.simpleclient.vertx.version")
compile 'io.prometheus:simpleclient_dropwizard:' + project.getProperty("prometheus.simpleclient.dropwizard.version")
compile 'io.prometheus:client:' + project.getProperty("prometheus.client.version")
compile "org.jetbrains.kotlin:kotlin-gradle-plugin:1.3.20"

annotationProcessor "io.vertx:vertx-service-proxy:3.6.2:processor"
annotationProcessor "io.vertx:vertx-codegen:3.6.2:processor"

//External project dependency.
compile project(':MWStaticInterface')
compile project(':MWCommons')
compile project(':MWStaticEMR1')
compile project(':MWStaticATHN')
compile project(':MWStaticMultiEMR')
compile project(':MWStaticSansoro')
compile project(':MWCronEngine')
}

When I execute command:  ./gradlew  annotationProcessing shadowJar
 It shows error:
* What went wrong:
Execution failed for task ':MWIntegrationEngine:annotationProcessing'.
> Annotation processor 'io.vertx.codegen.CodeGenProcessor' not found

But when I execute the command: ./gradlew build
I get: BUILD SUCCESSFUL in 30s

Any suggestion? 

rj.bh...@gmail.com

unread,
Feb 1, 2019, 8:46:15 AM2/1/19
to vert.x
More info: I am using Java Open JDK: 11.0.1

Pratik Parikh

unread,
Feb 1, 2019, 12:49:22 PM2/1/19
to ve...@googlegroups.com
Codegen is not supported for JDK 11 yet.  It only supports JDK8.  

--
You received this message because you are subscribed to the Google Groups "vert.x" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vertx+un...@googlegroups.com.
Visit this group at https://groups.google.com/group/vertx.
To view this discussion on the web, visit https://groups.google.com/d/msgid/vertx/0bc9a878-c5aa-4175-87d6-d45443f0406a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


--
Pratik Parikh
- Mantra - Keep It Simple and Straightforward

rj.bh...@gmail.com

unread,
Feb 4, 2019, 7:47:53 AM2/4/19
to vert.x
Thanks Pratik for the reply.

Yes. I looked into source code of VertX 3.5 for CodeProcessor which supports Java8 only. Even I looked into source code of VertX 3.6.2 (latest version) for the same Java class. There also the supported version is Java8.
Hence, I have written CustomCodeGenProcessor.
package com.abc.verticle;

import com.google.auto.service.AutoService;
import io.vertx.codegen.CodeGenProcessor;
import javax.annotation.processing.Processor;
import javax.lang.model.SourceVersion;

@AutoService(Processor.class)
public class CustomCodeGenProcessor extends CodeGenProcessor {
public SourceVersion getSupportedSourceVersion() {
return SourceVersion.latestSupported();
}
}




build.gradle looks like:
task annotationProcessing(type: JavaCompile, group: 'build') { // codegen
source = sourceSets.main.java
classpath = configurations.compile
  destinationDir = project.file('src/main/generated')
options.compilerArgs = [
"-proc:only",
    "-processor","com.abc.CustomCodeGenProcessor",
"-AoutputDirectory=${project.projectDir}/src/main"
]
}

compileJava {
dependsOn annotationProcessing
source annotationProcessing.destinationDir
}


I am getting same error: 
./gradlew annotationProcessing shadowJar

* What went wrong:
Execution failed for task ':MWIntegrationEngine:annotationProcessing'.
> Annotation processor 'com.abc.CustomCodeGenProcessor' not found

Pratik Parikh

unread,
Feb 4, 2019, 2:12:13 PM2/4/19
to ve...@googlegroups.com
Can you share how you have configured annotations processing in dependencies.  Also just overriding the class won't cut it as the MVEL dependencies are the root of the problem and the vert.x team is going to fix the as part of 4.0 release based on everything I have seen documented. Not to discourage you from try your experience, so if you share how you have configured your annotations processing in build.grade and I can suggest something.

rj.bh...@gmail.com

unread,
Feb 5, 2019, 12:42:02 AM2/5/19
to vert.x


//build.gradle


task annotationProcessing(type: JavaCompile, group: 'build') { // codegen
source = sourceSets.main.java
classpath = configurations.compile + configurations.compileOnly
destinationDir = project.file('src/main/generated')
options.compilerArgs = [
"-proc:only",
"-processor", "io.vertx.codegen.CodeGenProcessor",
"-Acodegen.output=${project.projectDir}/src/main"
]
}
dependencies {
// The production code uses the SLF4J logging API at compile time
    compile 'io.vertx:vertx-core:3.5.0'
    compile 'io.vertx:vertx-web:3.5.0'
    compile 'io.vertx:vertx-service-proxy:3.5.0'
compile 'io.vertx:vertx-codegen:3.5.0'
    annotationProcessor "io.vertx:vertx-service-proxy:3.5.0:processor"
annotationProcessor "io.vertx:vertx-codegen:3.5.0:processor"

//External project dependency.
compile project(':MWCommons')
}

Thanks again Pratik!
Message has been deleted

rj.bh...@gmail.com

unread,
Feb 5, 2019, 1:13:39 AM2/5/19
to vert.x
I have tried creating custom processor and running it with Java8. Gradle version- 4.9
it still gives error:
Execution failed for task ':MWIntegrationEngine:annotationProcessing'.
> Annotation processor 'com.abc.CustomCodeGenProcessor' not found

task annotationProcessing(type: JavaCompile, group: 'build') { // codegen
source = sourceSets.main.java
classpath = configurations.compile
destinationDir = project.file('src/main/generated')
options.compilerArgs = [
"-proc:only",
"-processor", "com.abc.CustomCodeGenProcessor",
"-AoutputDirectory=${project.projectDir}/src/main"
]
}

compileJava {
options.with {
encoding = 'utf-8'
compilerArgs << '-proc:none'
}
}

The default way to make an annotation processor available to the compiler is to register it in a file in META-INF/services/javax.annotation.processing.Processor. Hence, I created the same file and added processor path there.
com.abc.CustomCodeGenProcessor

Julien Ponge

unread,
Feb 5, 2019, 4:02:25 AM2/5/19
to ve...@googlegroups.com

Rajal Bhammar

unread,
Feb 5, 2019, 5:02:40 AM2/5/19
to ve...@googlegroups.com
I tried with Gradle 5.2 and used annotationProcessor dependencies still getting the same error.
* What went wrong:
Execution failed for task ':module:annotationProcessing'.
> Annotation processor 'com.abc.CustomCodeGenProcessor' not found

If I move to gralde 4.9 , it works. But as we are migrating to Java11, I have to use Gradle5+.

Added dependencies:
annotationProcessor("io.vertx:vertx-codegen:3.5.0:processor")
annotationProcessor("io.vertx:vertx-rx-java2:3.5.0")
annotationProcessor("io.vertx:vertx-rx-java2-gen:3.5.0")
distributionUrl=https\://services.gradle.org/distributions/gradle-5.2-bin.zip

Reply all
Reply to author
Forward
0 new messages