google-java-format
google-java-format copied to clipboard
Build Failure Issue Related to maven-javadoc-plugin in Windows Environment
Hello,
I am using it while satisfying the google-java-format.
I have a question about project build and would like to ask.
Build Environment
- Windows 10 / 11
- Maven 3.9.5
- Java 17 Temurin
Build Command
mvn clean package
When building in a Windows environment, there is always an error in the javadoc creation part.
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-javadoc-plugin:3.4.0:jar (attach-javadocs) on project google-java-format: MavenReportException: Error while generating Javadoc:
[ERROR] Exit code: 1 - Loading source file C:\git-other\google-java-format\core\src\main\java\com\google\googlejavaformat\CloseOp.java...
...
...
...
[ERROR] C:\git-other\google-java-format\core\src\main\java\com\google\googlejavaformat\java\JavaInputAstVisitor.java:33: error: package com.sun.source.tree is not visible
[ERROR] import static com.sun.source.tree.Tree.Kind.ARRAY_ACCESS;
[ERROR] ^
[ERROR] (package com.sun.source.tree is declared in module jdk.compiler, but module com.google.googlejavaformat does not read it)
[ERROR] 100 errors
[ERROR]
[ERROR] Command line was: cmd.exe /X /C "C:\JDK\17\bin\javadoc.exe --add-exports=jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED,com.google.googlejavaformat --add-exports=jdk.compiler/com.sun.tools.javac.code=ALL-UNNAMED,com.google.googlejavaformat --add-exports=jdk.compiler/com.sun.tools.javac.file=ALL-UNNAMED,com.google.googlejavaformat --add-exports=jdk.compiler/com.sun.tools.javac.parser=ALL-UNNAMED,com.google.googlejavaformat --add-exports=jdk.compiler/com.sun.tools.javac.tree=ALL-UNNAMED,com.google.googlejavaformat --add-exports=jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED,com.google.googlejavaformat @options @packages @argfile"
...
I don’t really care about JavaDoc, and I only need to use google-java-format-1.18.1-all-deps.jar that is created in google-java-format\core\target\. So, I changed the javadoc part of https://github.com/google/google-java-format/blob/v1.18.1/pom.xml to comments and built it.
...
<!--
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>3.4.0</version>
<configuration>
<doclint>none</doclint>
</configuration>
<executions>
<execution>
<id>attach-javadocs</id>
<goals>
<goal>jar</goal>
</goals>
</execution>
</executions>
</plugin>
-->
...
✨ Interestingly, the above problem did not occur in the Ubuntu environment of WSL.
I wrote this post because I was curious why a javadoc related error occurs in the Windows environment.
Thank you. Have a nice day. 👍