Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support on Java 11 #67

Closed
FroMage opened this issue Jul 30, 2018 · 15 comments
Closed

Support on Java 11 #67

FroMage opened this issue Jul 30, 2018 · 15 comments
Milestone

Comments

@FroMage
Copy link

FroMage commented Jul 30, 2018

Hi,

I've tried to run the generator plugin on Java 11 and didn't find how to make it work, because Java 11 removed the java.xml.bind module. I'm not sure if jooq or vertx-jooq is the issue, but I wanted to ask if you support Java 11 and if yes if you have some Maven configuration you can share?

Thanks!

@jklingsporn
Copy link
Owner

Hey, thanks for your answer. The project is currently built using Java 8. Unfortunately I haven't found the time to look into the compatibility with the latest java versions

@jklingsporn
Copy link
Owner

See also: https://groups.google.com/forum/?fromgroups#!topic/jooq-user/NRtyx-hdtdA
jooq 3.12. will support java 11 until then there is not much more that I can do.

@pablotdl
Copy link

Have you tried adding the jaxb jars explicitly to your classpath? I don't know if they work in Java 11, but they are available in a maven repo.

@abonander
Copy link

@pablotdl yes that does work, if you add them to your buildscript classpath:

buildscript {
	repositories { jcenter() }
	dependencies {
		classpath "io.github.jklingsporn:vertx-jooq-generate:4.1.0"
		classpath "org.glassfish.jaxb:jaxb-runtime:2.3.2"
	}
}

@aleksandar78
Copy link

Hi everyone,

a couple of months ago we have built Gradle plugin for code generation with vertx-jooq.
We had requirements to build the library with JDK 11 or above. We add a couple of dependencies for JAXB and annotation process and everything worked well.

Today we've tried to upgrade plugin dependencies with vertx-jooq 5.0.0 version.
We've found that JOOQ library 3.12.3 is imported as vertx-jooq transitive dependency and that generated classes have @generated annotation with import javax.annotation as in JDK 8 instead of javax.annotation.processing.
All our environments, IDE and CI, are configured with JDK 11 and above and this kind of import brakes our project imports.

Probably something changed with the new release but we cannot understand what.
Any suggestion welcome,

Thanks

@jklingsporn
Copy link
Owner

jklingsporn commented Jan 28, 2020 via email

@aleksandar78
Copy link

Thanks @jklingsporn. I found in official JOOQ documentation a possibility to specify the version of annotation processing import.

<configuration xmlns="http://www.jooq.org/xsd/jooq-codegen-3.12.0.xsd">
  <generator>
    <generate>
      <!-- Possible values for generatedAnnotationType
         - DETECT_FROM_JDK
         - JAVAX_ANNOTATION_GENERATED
         - JAVAX_ANNOTATION_PROCESSING_GENERATED -->
      <generatedAnnotation>true</generatedAnnotation>
      <generatedAnnotationType>DETECT_FROM_JDK</generatedAnnotationType>
      
      <jpaAnnotations>true</jpaAnnotations>
      <jpaVersion>2.2</jpaVersion>
      
      <validationAnnotations>true</validationAnnotations>
      <springAnnotations>true</springAnnotations>
    </generate>
  </generator>
</configuration>

I'll try to set some of these values in the XML configuration file and see what happens.

@aleksandar78
Copy link

I've tried to set specific values as gneratedAnnotationType but nothing changed. Import of @generated remains javax.annotation.

I'll skip annotation generation for now but this remains a problem caused by some transitive dependencies.

@jklingsporn
Copy link
Owner

I've just checked this. For some reason that flag is overridden in the VertxGenerator (Line 603):

@Override
public GeneratedAnnotationType generateGeneratedAnnotationType() {
     return GeneratedAnnotationType.JAVAX_ANNOTATION_GENERATED;
}

I will provide a fix - hopefully this week. Until then, please try to subclass the generator of your choice, e.g. ClassicJDBCVertxGenerator, overwrite that method and replace the generator in your pom with the new generator.

@aleksandar78
Copy link

Thanks @jklingsporn.
We disabled generation annotation and for now, we can generate classes and try other things.
We found another problem related to the latest vertx release with vertx-jooq library.
When we generate DAOs with our Gradle library our IDE ( Intellij Idea ) gives us the following error:

'queryExecutor()' in 'our.company.app.ExampleDao' clashes with 'queryExecutor()' in 'io.github.jklingsporn.vertx.jooq.shared.internal.AbstractVertxDAO'; 
attempting to use incompatible return type

We try to force vertx-sql client version to 3.8.5, instead of 3.8.4 that library brings as a transitive dependency, and that make generation works properly. Probably, the latest vertx versions can create some version incompatibility issues during code generation.

@jklingsporn
Copy link
Owner

I will upgrade the vertx-dependency with the next release as well and see how things are going.

jklingsporn added a commit that referenced this issue Jan 29, 2020
remove force of java 8 annotation
@jklingsporn
Copy link
Owner

I've just pushed to https://github.com/jklingsporn/vertx-jooq/tree/release5.0.1 which contains the generated-annotation fix and bumped the vertx version to 3.8.5.
All tests ran through, so it should be fine. Can you try your project against that branch?

@aleksandar78
Copy link

Sure @jklingsporn. Tomorrow I'll pull 5.0.1 branch, build the project and deploy on our local nexus as a snapshot. I'll let you know.
Thanks for feedback

@aleksandar78
Copy link

Hi @jklingsporn,

We tried to compile it with JDK 11 and we found compilation errors in vertx-jooq-generate tests. All generated classes had javax.annotation.Generated import and that package missing in JDK 11. We dropped folder with test and after that build completed successfully.

We tested with our generation Gradle plugin. With specified annotation type library generates annotation with correct import ( javax.annotation.processing ).
Incompatibility error regarding return type disappears.

IMO version 5.0.1 works well on JDK 11.

@jklingsporn
Copy link
Owner

jklingsporn commented Jan 31, 2020 via email

jklingsporn added a commit that referenced this issue Feb 6, 2020
remove Generated-annotation
@jklingsporn jklingsporn added this to the 5.0.1 milestone Feb 6, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants