neoforged / ModDevGradle

A Gradle plugin for developing Minecraft mods using NeoForge
https://projects.neoforged.net/neoforged/moddevgradle
GNU Lesser General Public License v2.1
38 stars 6 forks source link

Error when generating javadoc #156

Open MerchantPug opened 2 months ago

MerchantPug commented 2 months ago

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
MerchantPug commented 2 months ago

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.

shartte commented 2 months ago

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?

MerchantPug commented 2 months ago

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