ModDevGradle icon indicating copy to clipboard operation
ModDevGradle copied to clipboard

Error when generating javadoc

Open ChrysanthCow opened this issue 1 year ago • 3 comments

Hi, I'm getting an error whenever I generate the javadocs through the ./gradlew build command. I think it's being caused by not having access to certain NeoForge classes when trying to use the Shearable interface on an entity (I do know that this interface is deprecated, and I'll see if changing to IShearable is worth it).

Below are some debug logs that might lead to the issue.

2024-09-09T16:21:43.729+1000 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] FAILURE: Build failed with an exception.
2024-09-09T16:21:43.730+1000 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] 
2024-09-09T16:21:43.730+1000 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] * What went wrong:
2024-09-09T16:21:43.730+1000 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] Execution failed for task ':neoforge:javadoc'.
2024-09-09T16:21:43.730+1000 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] > Javadoc generation failed. Generated Javadoc options file (useful for troubleshooting): 
2024-09-09T16:21:42.771+1000 [ERROR] [system.err] C:\Users\User\Desktop\Programs\MCMods\bovines-and-buttercups\neoforge\build\moddev\artifacts\neoforge-21.1.45-minecraft-merged.jar(/net/minecraft/world/entity/Shearable.java):20: error: reference not found
2024-09-09T16:21:42.771+1000 [ERROR] [system.err]      * @deprecated Neo: Use {@link net.neoforged.neoforge.common.IShearable#isShearable(net.minecraft.world.item.ItemStack, net.minecraft.world.level.Level, net.minecraft.core.BlockPos)} instead.
2024-09-09T16:21:42.771+1000 [ERROR] [system.err]                                    ^
2024-09-09T16:21:42.776+1000 [ERROR] [system.err] C:\Users\User\Desktop\Programs\MCMods\bovines-and-buttercups\neoforge\build\moddev\artifacts\neoforge-21.1.45-minecraft-merged.jar(/net/minecraft/world/entity/Shearable.java):11: error: reference not found
2024-09-09T16:21:42.776+1000 [ERROR] [system.err]      * @deprecated Neo: Use {@link net.neoforged.neoforge.common.IShearable#onSheared(
2024-09-09T16:21:42.776+1000 [ERROR] [system.err]                                    ^
2024-09-09T16:21:43.559+1000 [ERROR] [system.err] 2 errors
2024-09-09T16:21:43.560+1000 [ERROR] [system.err] 100 warnings

ChrysanthCow avatar Sep 09 '24 06:09 ChrysanthCow

I have fixed this by changing to IShearable, but I think it's an issue with javadoc generation not getting NeoForge dependencies, so link annotations to NeoForge classes fail.

ChrysanthCow avatar Sep 09 '24 21:09 ChrysanthCow

I have not yet validated this, but just by looking at the Gradle code, javadoc should use the main source-set compile classpath by default.

Can you please post a link to your project?

shartte avatar Sep 09 '24 21:09 shartte

I'll post the repo at a specific commit hash, because I changed the implementation to IShearable. https://github.com/GreenhouseModding/bovines-and-buttercups/tree/6ef2825b1a8ee083bf93439543ed598bae865eef

ChrysanthCow avatar Sep 10 '24 07:09 ChrysanthCow

I checked out your repo and the gradlew :neoforge:javadoc task worked for me.

Technici4n avatar Apr 27 '25 10:04 Technici4n