Search code examples
javagradlegwtjavadoc

Gradle Javadoc GWT Error - cannot access Event in import com.google.gwt.user.client.Event


I am trying to generate the javadoc of a GWT Java project using gradle. When I run the task gradle build, the compilation is successful. However, when I run the gradle javadoc task, it fails with the following error:

C:\Users\jbraga.gradle\caches\modules-2\files-2.1\com.google.gwt\gwt-user\2.8.1\9a13fbee70848f1f1cddd3ae33ad180af3392d9e\gwt-user-2.8.1.jar(com/google/gwt/user/client/ui/Widget.java):28: error: cannot access Event import com.google.gwt.user.client.Event; ^ bad source file: C:\Users\jbraga.gradle\caches\modules-2\files-2.1\com.google.gwt\gwt-user\2.8.1\9a13fbee70848f1f1cddd3ae33ad180af3392d9e\gwt-user-2.8.1.jar(com/google/gwt/user/client/Event.java) file does not contain class com.google.gwt.user.client.Event Please remove or make sure it appears in the correct subdirectory of the sourcepath. C:\Users\jbraga.gradle\caches\modules-2\files-2.1\com.google.gwt\gwt-user\2.8.1\9a13fbee70848f1f1cddd3ae33ad180af3392d9e\gwt-user-2.8.1.jar(com/google/gwt/layout/client/Layout.java):18: error: cannot find symbol import static com.google.gwt.dom.client.Style.Unit.PX; ^ symbol: static PX location: class

FAILURE: Build failed with an exception.

  • What went wrong: Execution failed for task ':javadoc'. Javadoc generation failed. Generated Javadoc options file (useful for troubleshooting): 'C:\Users\jbraga\odsoft-18-19-nmb-g302\odsoft\exercise1\component1\students\build\tmp\javadoc\javadoc.options'

  • Try: Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

  • Get more help at https://help.gradle.org

BUILD FAILED in 4s

The GWT version I am using is 2.8.1 and the same occurs with 2.8.2. The gradle.properties file specifies the correct path to the SDK.

Does anyone have a solution to this problem?

Thanks in advance.


Solution

  • This is a known Gradle issue: https://github.com/gradle/gradle/issues/5630, fortunately with a known workaround:

    javadoc {
      options.addStringOption("sourcepath", "")
    }