Compiling from source code
SladeHazard opened this issue · 21 comments
How can I compile the plugin from the default source code provided on github?
[ERROR] Failed to execute goal on project Magic: Could not resolve dependencies for project com.elmakers.mine.bukkit.plugins:Magic:jar:10.8.12-SNAPSHOT: The following artifacts could not be resolved: com.elmakers.mine.bukkit.compatibility:CompatibilityLib:jar:10.8.12-SNAPSHOT (absent): com.elmakers.mine.bukkit.compatibility:CompatibilityLib:jar:10.8.12-SNAPSHOT was not found in https://maven.elmakers.com/repository/ during a previous attempt. This failure was cached in the local repository and resolution is not reattempted until the update interval of elMakers has elapsed or updates are forced -> [Help 1]
You have to build the parent project, CompatibilityLib is part of that.
Do you have something in your compiler turning warnings into errors?
What java compiler version are you using?
That out of range shift error I've never seen before in my life, wonder if it's new or some other linty thing you have turned on. I have to admit that it is probably wrong- hash code would need to be a long to hold that many bits. That's a little disturbing, but has never been a build issue before.
All of the rest of those look like they have to do with building against the CraftBukkit/Mojang code- this does often print a lot of warnings but hasn't been a build issue either.
Do you have something in your compiler turning warnings into errors? What java compiler version are you using?
That out of range shift error I've never seen before in my life, wonder if it's new or some other linty thing you have turned on. I have to admit that it is probably wrong- hash code would need to be a long to hold that many bits. That's a little disturbing, but has never been a build issue before.
All of the rest of those look like they have to do with building against the CraftBukkit/Mojang code- this does often print a lot of warnings but hasn't been a build issue either.
would it be possible to know what maven version you are using? because I did have to remove the errorprone plugin as it didn't work for me
Maven 3.8.1 and Java 17
Maven 3.8.1 and Java 17
still same sadly: (also its not possible to download 3.8.1 anymore, the lowest i could find is 3.8.8)
C:\Users\Archer.jdks\openjdk-17.0.2\bin\java.exe -Dmaven.multiModuleProjectDirectory=C:\Users\Archer\IdeaProjects\MagicPlugin -Djansi.passthrough=true "-Dmaven.home=C:\Program Files\maven-3.8.8" "-Dclassworlds.conf=C:\Program Files\maven-3.8.8\bin\m2.conf" "-Dmaven.ext.class.path=C:\Program Files\JetBrains\IntelliJ IDEA Community Edition 2022.3.2\plugins\maven\lib\maven-event-listener.jar" "-javaagent:C:\Program Files\JetBrains\IntelliJ IDEA Community Edition 2022.3.2\lib\idea_rt.jar=51283:C:\Program Files\JetBrains\IntelliJ IDEA Community Edition 2022.3.2\bin" -Dfile.encoding=UTF-8 -classpath "C:\Program Files\maven-3.8.8\boot\plexus-classworlds-2.6.0.jar;C:\Program Files\maven-3.8.8\boot\plexus-classworlds.license" org.codehaus.classworlds.Launcher -Didea.version=2023.3 -v
Apache Maven 3.8.8 (4c87b05d9aedce574290d1acc98575ed5eb6cd39)
Maven home: C:\Program Files\maven-3.8.8
Java version: 17.0.2, vendor: Oracle Corporation, runtime: C:\Users\Archer.jdks\openjdk-17.0.2
Default locale: en_CA, platform encoding: UTF-8
OS name: "windows 11", version: "10.0", arch: "amd64", family: "windows"
Process finished with exit code 0
[INFO]
[INFO] --< com.elmakers.mine.bukkit.compatibility:CompatibilityLib-v1_17_0 >---
[INFO] Building CompatibilityLib-v1_17_0 10.8.12-SNAPSHOT [18/34]
[INFO] from CompatibilityLib\v1_17_0\pom.xml
[INFO] --------------------------------[ jar ]---------------------------------
[INFO]
[INFO] --- maven-checkstyle-plugin:3.1.1:check (validate) @ CompatibilityLib-v1_17_0 ---
[INFO] Starting audit...
Audit done.
[INFO] You have 0 Checkstyle violations.
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ CompatibilityLib-v1_17_0 ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory C:\Users\Archer\IdeaProjects\MagicPlugin\CompatibilityLib\v1_17_0\src\main\resources
[INFO]
[INFO] --- maven-compiler-plugin:3.8.1:compile (default-compile) @ CompatibilityLib-v1_17_0 ---
[INFO] Compiling 8 source files to C:\Users\Archer\IdeaProjects\MagicPlugin\CompatibilityLib\v1_17_0\target\classes
[WARNING] Unable to autodetect 'javac' path, using 'javac' from the environment.
[INFO] -------------------------------------------------------------
[ERROR] COMPILATION ERROR :
[INFO] -------------------------------------------------------------
[ERROR] error: invalid flag: -XepDisableAllChecks
[INFO] 1 error
[INFO] -------------------------------------------------------------
What is this flag, can you remove it?
[ERROR] error: invalid flag: -XepDisableAllChecks
What is this flag, can you remove it?
[ERROR] error: invalid flag: -XepDisableAllChecks
Yes removing those flags led me to the LoadingChunk & NBTUtils errors. however setting my java version to 8 fixes the flag errors, but fails to compile when it reaches version 1.17
udit done.
[INFO] You have 0 Checkstyle violations.
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ CompatibilityLib-v1_17_0 ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory C:\Users\Archer\IdeaProjects\MagicPlugin\CompatibilityLib\v1_17_0\src\main\resources
[INFO]
[INFO] --- maven-compiler-plugin:3.8.1:compile (default-compile) @ CompatibilityLib-v1_17_0 ---
[INFO] Compiling 8 source files to C:\Users\Archer\IdeaProjects\MagicPlugin\CompatibilityLib\v1_17_0\target\classes
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary for Magic-parent 10.8.12-SNAPSHOT:
[INFO]
[INFO] Magic-parent ....................................... SUCCESS [ 1.003 s]
[INFO] Magic API .......................................... SUCCESS [ 1.219 s]
[INFO] CompatibilityLib-parent ............................ SUCCESS [ 0.066 s]
[INFO] CompatibilityLib-common ............................ SUCCESS [ 0.314 s]
[INFO] CompatibilityLib-paper ............................. SUCCESS [ 0.203 s]
[INFO] CompatibilityLib-spigot ............................ SUCCESS [ 0.100 s]
[INFO] CompatibilityLib-base .............................. SUCCESS [ 0.227 s]
[INFO] CompatibilityLib-legacy ............................ SUCCESS [ 0.162 s]
[INFO] CompatibilityLib-v1_9 .............................. SUCCESS [ 0.119 s]
[INFO] CompatibilityLib-v1_10 ............................. SUCCESS [ 0.118 s]
[INFO] CompatibilityLib-v1_11 ............................. SUCCESS [ 0.148 s]
[INFO] CompatibilityLib-v1_12 ............................. SUCCESS [ 0.153 s]
[INFO] CompatibilityLib-v1_13 ............................. SUCCESS [ 0.119 s]
[INFO] CompatibilityLib-v1_14 ............................. SUCCESS [ 0.133 s]
[INFO] CompatibilityLib-v1_15 ............................. SUCCESS [ 0.110 s]
[INFO] CompatibilityLib-v1_16 ............................. SUCCESS [ 0.138 s]
[INFO] CompatibilityLib-modern ............................ SUCCESS [ 0.135 s]
[INFO] CompatibilityLib-v1_17_0 ........................... FAILURE [ 0.437 s]
[INFO] CompatibilityLib-v1_17_1 ........................... SKIPPED
[INFO] CompatibilityLib-v1_18_0 ........................... SKIPPED
[INFO] CompatibilityLib-v1_18_1 ........................... SKIPPED
[INFO] CompatibilityLib-v1_18_2 ........................... SKIPPED
[INFO] CompatibilityLib-v1_19_0 ........................... SKIPPED
[INFO] CompatibilityLib-v1_19_1 ........................... SKIPPED
[INFO] CompatibilityLib-v1_19_2 ........................... SKIPPED
[INFO] CompatibilityLib-v1_19_3 ........................... SKIPPED
[INFO] CompatibilityLib-v1_19_4 ........................... SKIPPED
[INFO] CompatibilityLib-v1_20_0 ........................... SKIPPED
[INFO] CompatibilityLib-v1_20_1 ........................... SKIPPED
[INFO] CompatibilityLib-v1_20_2 ........................... SKIPPED
[INFO] CompatibilityLib-v1_20_3 ........................... SKIPPED
[INFO] CompatibilityLib-v1_20_4 ........................... SKIPPED
[INFO] Magic Compatibility Library ........................ SKIPPED
[INFO] Magic Bukkit Plugin ................................ SKIPPED
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 5.811 s
[INFO] Finished at: 2024-01-05T12:48:02-05:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.8.1:compile (default-compile) on project CompatibilityLib-v1_17_0: Compilation failure -> [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/MojoFailureException
[ERROR]
[ERROR] After correcting the problems, you can resume the build with the command
[ERROR] mvn -rf :CompatibilityLib-v1_17_0
Process finished with exit code 1
You will need a more recent version of Java than 8. I think the NMS bindings require 17 at this point.
You will need a more recent version of Java than 8. I think the NMS bindings require 17 at this point.
I have tried with 17 as well before this, it's the same issue. either the ErrorProne plugin's errors, or version 17 failing and I don't think it has anything to do with my setup as I tried with default IDE, maven and java configurations
I'm sorry, I can't really debug your build environment. I've never had these kind of issues, nor has my build server or anyone else that's tried to build it (though there probably aren't many of those).
The errors you've been showing look like warnings to me so I'm really not sure what's going on :(
If you can build the parent with Java 17 and Maven 3.8.1 (or close to that), no special flags or anything hacked out, then paste the output logs (as a pastebin or gist, they'll be very long) I can take a look.
I would caution you, however, if your end goal here is to try to debug and fix the weird incompatibility issues you're having on your own, you're probably in for a world of hurt far outweighing getting the build working 😅
If you can build the parent with Java 17 and Maven 3.8.1 (or close to that), no special flags or anything hacked out, then paste the output logs (as a pastebin or gist, they'll be very long) I can take a look.
Here is a fresh install using java 17 with errorplugin removed:
Thanks!
So there were some real errors in there, related to an update I made a while ago to EffectLib, but forgot to upload to my Maven repo.
Since the build server also builds EffectLib, it had the updated version and I didn't see the problem.
This accounts for the 3 errors in your most recent screenshot.
Sorry about that!
I've updated the Maven repo with latest EffectLib, and have verified a clean build succeeds with an empty local Maven repo.
So it should work now, you'll probably need -U
to Maven to force it to re-download EffectLib.
I still can't say why you need to disable ErrorProne (shouldn't have to) or why some warnings were showing up as errors for you, but hopefully those were all some kind of side-effect of the build failures.
works now thank you, and it'll be really easy to fix the compatability issue (i hope) lol, will just have to add debugs on every player.closeinventory. as my other plugin is custom and im using fastinv's library to create my inventories. other than that the plugin also has a lot of performance issues while being idle on a server handling 300+ players
I have no changed anything that should cause MagicAPI to fail. That one has almost no dependencies other than the spigot API.
The only recent change that could be build-breaking is an EffectLib version bump, but
- That would only affect MagicPlugin, not the API
- I made sure to publish that EffectLib version to Maven Central
I don't see an actual failure or error message in your logs though, can you try again with a clean package
and see if an error shows up?
This solved my issue https://youtrack.jetbrains.com/issue/IDEA-278903. Thank you