gwt-elemental contains both class and java files in same JAR
See original GitHub issueThe gwt-elemental artifact provided by Vaadin and a dependency of flow-server seems to have a packaging issue. The binary JAR gwt-elemental-2.8.2.vaadin2.jar as well as the sources JAR gwt-elemental-2.8.2.vaadin2-sources.jar both contain the class as well as the java files.
This leads to errors like this when running Javadoc (with Java 11):
/project/src/main/java/my/package/MyClass.java:11: error: cannot access Json import elemental.json.Json; ^ bad source file: /project/.m2/repository/com/vaadin/external/gwt/gwt-elemental/2.8.2.vaadin2/gwt-elemental-2.8.2.vaadin2.jar(/elemental/json/Json.java) file does not contain class elemental.json.Json Please remove or make sure it appears in the correct subdirectory of the sourcepath.
Issue Analytics
- State:
- Created 3 years ago
- Comments:8 (4 by maintainers)
Top GitHub Comments
I was compiling with <maven.compiler.source>1.8</maven.compiler.source> <maven.compiler.target>1.8</maven.compiler.target> anyway. But it seems the Javadoc plugin only reacts to maven.compiler.release. After switching to that it works now. Still, full Java 11 compatibility with regards to Javadoc would be nice at some point in the future, even though I mostly blame Javadoc for it’s overly sensitive behavior.
I started with the template project from https://vaadin.com/start/lts/component - which I suppose is the same as the linked Github repository - and then rearranged it to match my other non-Vaadin projects. But ultimately it’s still a pretty standard Java Maven project.
I now tried to recreate the problem with a fresh addon starter by copying over my source, adding some dependencies, using the latest versions of the javadoc and compiler plug-ins and setting maven.compiler.release to 11. But Javadoc worked fine… So I picked them both apart and camparing them bit by bit I found the critical difference: I have added an
Automatic-Module-Name
to the Manifest in themaven-jar-plugin
. Without it everything works as expected.Either way, you are correct that it’s not a problem with gwt-elemental. Judging from javac’s command line flag -Xprefer having both source and binary of a class is explicitly supported. So, from what I have gathered this has to be a Javadoc bug. The error message doesn’t even make sense: it finds the source file and complains that it doesn’t contain the expected class which it absolutely does.
Seeing as there isn’t anything to fix on your end I’m closing this ticket. Sorry for wasting your time 😕 Hopefully, the next poor soul stumbling across this error finds this ticket.
BTW, I tried sourcepath. Setting it to blank had no change. With a dummy value Javadoc wouldn’t fail but also not create any API - duh.
${basedir}/src/main/java
triggered yet another error. So it didn’t work as workaround for me.