This is NOT a duplicate of this question . I am having trouble includding external dependencies to my Javadoc, which is not what that question is about.
I am trying to deploy my API to Maven Central. Everything is going smooth, except for the Maven Javadoc plugin. My API has two dependencies (Spigot API - org.spigotmc:spigot-api:1.19-R0.1-SNAPSHOT
and JetBrains Annotations - org.jetbrains:annotations:23.0.0
).
Running mvn clean deploy
triggers the Javadoc plugin, which follows into a verbose error:
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 7.253 s
[INFO] Finished at: 2022-07-14T20:10:43+05:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-javadoc-plugin:3.4.0:jar (attach-javadocs) on project UnderscoreEnchantsAPI: MavenReportException: Error while generating Javadoc:
[ERROR] Exit code: 1 - path\to\project\UnderscoreEnchantsAPI\src\main\java\com\roughlyunderscore\enchantsapi\events\EnchantmentsCombineEvent.java:3: error: package org.bukkit.entity does not exist
[ERROR] import org.bukkit.entity.Player;
[ERROR] ^
[ERROR] path\to\project\UnderscoreEnchantsAPI\src\main\java\com\roughlyunderscore\enchantsapi\events\EnchantmentsCombineEvent.java:4: error: package org.bukkit.event does not exist
[ERROR] import org.bukkit.event.Cancellable;
[ERROR] ^
[ERROR] path\to\project\UnderscoreEnchantsAPI\src\main\java\com\roughlyunderscore\enchantsapi\events\EnchantmentsCombineEvent.java:5: error: package org.bukkit.event does not exist
[ERROR] import org.bukkit.event.Event;
[ERROR] ^
[ERROR] path\to\project\UnderscoreEnchantsAPI\src\main\java\com\roughlyunderscore\enchantsapi\events\EnchantmentsCombineEvent.java:6: error: package org.bukkit.event does not exist
[ERROR] import org.bukkit.event.HandlerList;
[ERROR] ^
[ERROR] path\to\project\UnderscoreEnchantsAPI\src\main\java\com\roughlyunderscore\enchantsapi\events\EnchantmentsCombineEvent.java:7: error: package org.bukkit.inventory does not exist
[ERROR] import org.bukkit.inventory.ItemStack;
[ERROR] ^
[ERROR] path\to\project\UnderscoreEnchantsAPI\src\main\java\com\roughlyunderscore\enchantsapi\events\EnchantmentsCombineEvent.java:8: error: package org.jetbrains.annotations does not exist
[ERROR] import org.jetbrains.annotations.NotNull;
[ERROR] ^
... A LOT MORE ...
[ERROR] path\to\project\UnderscoreEnchantsAPI\src\main\java\com\roughlyunderscore\enchantsapi\events\PreEnchantEvent.java:23: error: cannot find symbol
[ERROR] public PreEnchantEvent(@NotNull Player player, @NotNull Enchantment enchantment, int level, @NotNull ItemStack item) {
[ERROR] ^
[ERROR] symbol: class NotNull
[ERROR] location: class PreEnchantEvent
[ERROR] path\to\project\UnderscoreEnchantsAPI\src\main\java\com\roughlyunderscore\enchantsapi\events\PreEnchantEvent.java:23: error: cannot find symbol
[ERROR] public PreEnchantEvent(@NotNull Player player, @NotNull Enchantment enchantment, int level, @NotNull ItemStack item) {
[ERROR] ^
[ERROR] symbol: class NotNull
[ERROR] location: class PreEnchantEvent
[ERROR]
[ERROR] Command line was: cmd.exe /X /C "path\to\jdks\.jdks\corretto-16.0.2\bin\javadoc.exe @options @packages @argfile"
[ERROR]
[ERROR] Refer to the generated Javadoc files in 'path\to\project\UnderscoreEnchantsAPI\target\apidocs' dir.
[ERROR]
[ERROR] -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException
From what I pre-concluded, maven-javadoc-plugin does not see the dependencies that I have. Now, here is my pom.xml, or, actually, the parts that matter:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>3.4.0</version>
<executions>
<execution>
<id>attach-javadocs</id>
<goals>
<goal>jar</goal>
</goals>
</execution>
</executions>
<configuration>
<links>
<link>https://hub.spigotmc.org/javadocs/bukkit/</link>
<link>https://javadoc.io/doc/org.jetbrains/annotations-java5/23.0.0/</link>
</links>
<!-- The links section does not seem to help! -->
</configuration>
</plugin>
<repositories>
<repository>
<id>spigotmc-repo</id>
<url>https://hub.spigotmc.org/nexus/content/repositories/snapshots/</url>
</repository>
<repository>
<id>sonatype</id>
<url>https://oss.sonatype.org/content/groups/public/</url>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>org.spigotmc</groupId>
<artifactId>spigot-api</artifactId>
<version>1.19-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.jetbrains</groupId>
<artifactId>annotations</artifactId>
<version>23.0.0</version>
<scope>provided</scope>
</dependency>
</dependencies>
If for any reason at all you would like to see my full pom.xml, it's here . The full error can be found here . Any help is appreciated. This error has been bothering me for more than a week now and I couldn't seem to find any of such problems (many similar, but none that had this very problem). Any help is appreciated.
Edit: Adding <configuration><doclint>none</doclint></configuration>
doesn't help.
I managed to resolve this problem by building the project against Java 1.8 and adding the following block into my pom.xml:
<profiles>
<profile>
<id>doclint-java8-disable</id>
<activation>
<jdk>[1.8,)</jdk>
</activation>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>3.4.0</version>
<configuration>
<links>
<link>https://hub.spigotmc.org/javadocs/bukkit/</link>
<link>https://javadoc.io/doc/org.jetbrains/annotations-java5/23.0.0/</link>
</links>
<additionalOptions>
<additionalOption>-Xdoclint:none</additionalOption>
</additionalOptions>
</configuration>
</plugin>
</plugins>
</build>
</profile>
</profiles>
This is a hacky way, and I am still looking for a way to make it work on Java 16. Do suggest your ideas if you have any.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.