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

Plugin not compatible with java 9 #74

Closed
xeagle2 opened this issue Jan 24, 2018 · 6 comments
Closed

Plugin not compatible with java 9 #74

xeagle2 opened this issue Jan 24, 2018 · 6 comments
Assignees
Milestone

Comments

@xeagle2
Copy link
Contributor

xeagle2 commented Jan 24, 2018

Hi @McFoggy

If using any recent version of plugin in tandem with Java 9, without adding additional modules the build mvn ... fails explicitly with

[WARNING] Error injecting: fr.brouillard.oss.jgitver.JGitverModelProcessor
java.lang.NoClassDefFoundError: javax/xml/bind/JAXBException
    at java.lang.Class.getDeclaredConstructors0 (Native Method)
    at java.lang.Class.privateGetDeclaredConstructors (Class.java:3110)
    at java.lang.Class.getDeclaredConstructors (Class.java:2314)
    at com.google.inject.spi.InjectionPoint.forConstructorOf (InjectionPoint.java:245)
    at com.google.inject.internal.ConstructorBindingImpl.create (ConstructorBindingImpl.java:99)
    at com.google.inject.internal.InjectorImpl.createUninitializedBinding (InjectorImpl.java:658)
    at com.google.inject.internal.InjectorImpl.createJustInTimeBinding (InjectorImpl.java:882)
...

The JAXB APIs are considered to be Java EE APIs, and therefore are no longer contained on the default class path in Java SE 9.

There is an option to run with -add-modules java.se.ee or -add-modules java.xml.bind but it won't be backwards compatible. It would make probably sense to avoid using java.xml.bind and substitute it by anything else or define the dependencies explicitly in plugin such as

<!-- Java 6 = JAX-B Version 2.0   -->
<!-- Java 7 = JAX-B Version 2.2.3 -->
<!-- Java 8 = JAX-B Version 2.2.8 -->
<dependency>
    <groupId>javax.xml.bind</groupId>
    <artifactId>jaxb-api</artifactId>
    <version>2.3.0</version>
</dependency>
<dependency>
    <groupId>com.sun.xml.bind</groupId>
    <artifactId>jaxb-core</artifactId>
    <version>2.3.0</version>
</dependency>
<dependency>
    <groupId>com.sun.xml.bind</groupId>
    <artifactId>jaxb-impl</artifactId>
    <version>2.3.0</version>
</dependency>

and use

<plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-plugin-plugin</artifactId>
                <version>3.5</version>
</plugin>
@McFoggy
Copy link
Contributor

McFoggy commented Jan 25, 2018

Thanks for reporting, I'll look at ways to fix that.

@drivenbyentropy
Copy link

Can confirm. I am running into the same issue. It might also be worth mentioning that the --add-module option might work for Java 9, but it is likely not going to be compatible with future versions as the APIs are scheduled for removal in Java 10.

It would be awesome to have a working version of this amazing plugin available for JAVA 9+. Thank you for this great module!

@McFoggy
Copy link
Contributor

McFoggy commented Feb 2, 2018

see also jOOQ/jOOQ#6477

I'll probably relax the way the configuration XML is read to remove jaxb dependency or use a different library.

@McFoggy McFoggy self-assigned this Feb 2, 2018
@McFoggy
Copy link
Contributor

McFoggy commented Feb 2, 2018

what I have done:

  • use simplexml instead of jaxb
  • remove everything related to jaxb, java.xml.*
  • minimal update of maven dependencies to be java 9 compliant

@McFoggy McFoggy closed this as completed in 5b7e68e Feb 2, 2018
@McFoggy
Copy link
Contributor

McFoggy commented Feb 2, 2018

just released 1.2.0-alpha01 and tested it using following java/maven version:

D:\dev\projects\personnal\oss\jgitver\jgitver-maven-plugin>mvn -version
Apache Maven 3.3.9 (bb52d8502b132ec0a5a3f4c09453c07478323dc5; 2015-11-10T17:41:47+01:00)
Maven home: D:\dev\tools\apache\maven\latest\bin\..
Java version: 9.0.1, vendor: Oracle Corporation
Java home: D:\dev\tools\jdks\1.9
Default locale: en_US, platform encoding: Cp1252
OS name: "windows 10", version: "10.0", arch: "amd64", family: "dos"

D:\dev\projects\personnal\oss\jgitver\jgitver-maven-plugin>mvn validate
[INFO] using jgitver configuration file: D:\dev\projects\personnal\oss\jgitver\jgitver-maven-plugin\.mvn\jgitver.config.xml
[INFO] Scanning for projects...
[INFO] jgitver-maven-plugin is about to change project(s) version(s)
[INFO]     fr.brouillard.oss::jgitver-maven-plugin::0 -> 1.2.0-java9-SNAPSHOT
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building jgitver Maven Plugin 1.2.0-java9-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- license-maven-plugin:2.11:check (default) @ jgitver-maven-plugin ---
[INFO] Checking licenses...
[INFO]
[INFO] --- maven-checkstyle-plugin:2.17:check (validate) @ jgitver-maven-plugin ---
[INFO] Starting audit...
...
Audit done.
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 3.992 s
[INFO] Finished at: 2018-02-02T14:20:01+01:00
[INFO] Final Memory: 19M/66M
[INFO] ------------------------------------------------------------------------

@drivenbyentropy
Copy link

Works for me as well. Thanks for taking care of this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants