question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

gwt-elemental contains both class and java files in same JAR

See original GitHub issue

The 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:closed
  • Created 3 years ago
  • Comments:8 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
Frettmancommented, May 29, 2020

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.

0reactions
Frettmancommented, Jun 2, 2020

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 the maven-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.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Which java class file will be called if same class is packed in ...
If both jar files are in the same ClassLoader, for instance the Java classpath ( -cp option), normally it should be the first...
Read more >
Create a JAR File Containing the Class File
The Java Tutorials have been written for JDK 8. ... This creates a JAR file, Count.jar , and places the Count.class file inside...
Read more >
Creating a Jar File that Contains a Manifest - UTK EECS
A JAR file is similar to a tar file in that it constitutes an archive of Java class files and source files. JAR...
Read more >
Importing and Exporting Java Projects as JAR Files in Eclipse
One of the most convenient ways to archive a Java project is to store it in a JAR (Java ARchive) file. JAR files...
Read more >
Creating a Jar File
Please be sure that your JAR file contains both the class file(s) and the java file(s) needed for the assignment. To check that...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found