Using Internal Api's (jdk.javadoc) with Maven

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Using Internal Api's (jdk.javadoc) with Maven

Brandon Lax
Hi,

I was hoping to get some help with an issue I have been facing relating to the maven-compiler-plugin. I have been using the jdk.javadoc api as part of my project. The code can compile directly (by running javac on the main file), but when trying to build with maven I get error messages that the package jdk.javadoc can not be found. Previously, the solution had been to add the Tools.jar <https://stackoverflow.com/questions/3080437/jdk-tools-jar-as-maven-dependency> file as a dependency, as that jar contained headers for most of the internal apis, but that jar was removed in java 9. Does anyone know of how to setup the compiler plugin to access these internal apis.

Best,
Brandon

Reply | Threaded
Open this post in threaded view
|

Re: Using Internal Api's (jdk.javadoc) with Maven

Enrico Olivelli
Brandon,
which JDK are you using ?

I have a finding that is related to your issue and probably the solution
will be in common.
While testing the Apache ZooKeeper project in the scope of the Quality
Outreach JDK project I have encountered this issue and we are still
investigating.
https://bugs.openjdk.java.net/browse/JDK-8253996
It is about having jdk.javadoc module available to javac when we are using
maven-compiler-plugin and running javac in the same process as Maven (using
fork=true fixes the problem).
In fact from JDK16+ in order to be able to use -Xdoclint:-missing compiler
argument that jdk.javadoc module must be on the module path, but is it not
present while running Maven (is it because Maven is running with the
classpath and the module path ??)

Adding --add-modules=jdk.javadoc does not help.

I have not raised an issue to maven-compiler-plugin (or plexus compiler or
to Maven core) because the issue is still under triage by JDK team

hope that helps
Enrico


Il giorno lun 19 ott 2020 alle ore 07:27 Brandon Lax <[hidden email]>
ha scritto:

> Hi,
>
> I was hoping to get some help with an issue I have been facing relating to
> the maven-compiler-plugin. I have been using the jdk.javadoc api as part of
> my project. The code can compile directly (by running javac on the main
> file), but when trying to build with maven I get error messages that the
> package jdk.javadoc can not be found. Previously, the solution had been to
> add the Tools.jar <
> https://stackoverflow.com/questions/3080437/jdk-tools-jar-as-maven-dependency>
> file as a dependency, as that jar contained headers for most of the
> internal apis, but that jar was removed in java 9. Does anyone know of how
> to setup the compiler plugin to access these internal apis.
>
> Best,
> Brandon
>
>