CodeGen - Unable to generate code for interfaces

478 views
Skip to first unread message

James Bench

unread,
Mar 11, 2016, 9:57:32 AM3/11/16
to ve...@googlegroups.com

Hello,

 

I've written a custom authentication Handler/Provider allowing VertX web to use an internal system to provide authentication - it works great :-)

 

I've been trying to use the VertX-RX library to see if we prefer the programming style and I therefore want to generate an RX version of my library using CodeGen.

 

So far I have done the following:

 

·         Added io.vertx:vertx-codegen:3.2.1 as a dependency.

·         Added @VertxGen() annotations too my AuthHandler and AuthProvider interfaces.

·         Added a package-info.java to the project:

@ModuleGen(name = "vertx-customauth", groupPackage="uk.co.spgroup")
package uk.co.spgroup.vertxcustomauth;

·         Added the annotation processor to my Gradle build file:

apply plugin: 'java'
apply plugin: 'maven'
apply plugin: 'idea'

group 'uk.co.spgroup'
version '1.0-SNAPSHOT'

sourceCompatibility = 1.8

repositories {
    mavenCentral()
}

ext {
    generated = file("$projectDir/src/main/generated")
}
configurations {
    annotationProcessor
}
sourceSets {
    main {
        java {
            srcDirs generated
        }
    }
}

dependencies {
    compile 'io.vertx:vertx-auth-common:3.2.1'
    compile 'io.vertx:vertx-web:3.2.1'
    compile 'io.vertx:vertx-codegen:3.2.1'
    testCompile group: 'junit', name: 'junit', version: '4.11'
    annotationProcessor 'io.vertx:vertx-codegen:3.2.1'
}

task cleanGenerated(type: Delete) {
    delete generated
}

compileJava {
    dependsOn cleanGenerated
    doFirst {
        mkdir generated
    }
    options.compilerArgs += [
            "-s", generated,
            "-AoutputDirectory=$projectDir/src/main",
            "-processor", "io.vertx.codegen.CodeGenProcessor"
    ]
    classpath += configurations.annotationProcessor
}

·         And run a build:

14:42:54: Executing external tasks 'clean build'...
:clean
:cleanGenerated
:compileJava
Interface uk.co.spgroup.vertxcustomauth.CustomAuthHandler does not redeclare the @Fluent return type  of method addAuthority(java.lang.String) declared by io.vertx.ext.web.handler.AuthHandler
Interface uk.co.spgroup.vertxcustomauth.CustomAuthHandler does not redeclare the @Fluent return type  of method addAuthorities(java.util.Set<java.lang.String>) declared by io.vertx.ext.web.handler.AuthHandler
C:\codes\vertx-customauth\src\main\java\uk\co\spgroup\vertxcustomauth\CustomAuthAuthHandler.java:12: warning: Interface uk.co.spgroup.vertxcustomauth.CustomAuthHandler does not redeclare the @Fluent return type  of method addAuthority(java.lang.String) declared by io.vertx.ext.web.handler.AuthHandler
public interface CustomAuthHandler extends AuthHandler {
       ^
C:\codes\vertx-customauth\src\main\java\uk\co\spgroup\vertxcustomauth\CustomAuthHandler.java:12: warning: Interface uk.co.spgroup.vertxcustomauth.CustomAuthHandler does not redeclare the @Fluent return type  of method addAuthorities(java.util.Set<java.lang.String>) declared by io.vertx.ext.web.handler.AuthHandler
public interface CustomAuthHandler extends AuthHandler {
       ^
2 warnings
:processResources UP-TO-DATE
:classes
:jar
:assemble
:compileTestJava UP-TO-DATE
:processTestResources UP-TO-DATE
:testClasses UP-TO-DATE
:test UP-TO-DATE
:check UP-TO-DATE
:build

BUILD SUCCESSFUL

Total time: 0.55 secs
14:42:55: External tasks execution finished 'clean build'.


But the generated folder remains empty?

I assume I've missed a step or annotation somewhere but I can't figure it out - has anyone any experience with this and are you able to point me in the right direction?

Cheers,
JB

Julien Viet

unread,
Mar 13, 2016, 6:09:26 PM3/13/16
to ve...@googlegroups.com
Hi,

do you have Rxjava jar on the classpath when compiling ? because it does not seem to be here when I read the “dependencies” block.



--
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/CAD28MY6g7_jSJ0jug6k0g%3DiDuQ%2BdwhQN8nXqFyAgAgaM3tJz7w%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

James Bench

unread,
Mar 14, 2016, 9:42:30 AM3/14/16
to vert.x
I didn't - I added 'io.vertx:vertx-rx-java:3.2.1' to my dependencies and now it's working thanks.
Reply all
Reply to author
Forward
0 new messages