ScriptCraft

ScriptCraft

14.6k Downloads

Compile error

steff1193 opened this issue ยท 7 comments

commented

I just wanted to try this out today. Downloaded BuildTools.jar, moved it to a spigotmc folder and ran "java -jar BuildTools.jar". It does a lot of downloading and building, but eventually it ends up failing. See the last lines of the build, containing the build error below. What can I do to make it work?

[INFO] --- maven-compiler-plugin:3.7.0:compile (default-compile) @ craftbukkit ---
[INFO] Changes detected - recompiling the module!
[INFO] -------------------------------------------------------------
[ERROR] COMPILATION ERROR : 
[INFO] -------------------------------------------------------------
[ERROR] /Applications/spigotmc/CraftBukkit/src/main/java/org/bukkit/craftbukkit/command/ColouredConsoleSender.java:[50] The method isAnsiSupported() is undefined for the type Terminal
[ERROR] /Applications/spigotmc/CraftBukkit/src/main/java/net/minecraft/server/MinecraftServer.java:[593] The method restore() is undefined for the type Terminal
[ERROR] /Applications/spigotmc/CraftBukkit/src/main/java/org/bukkit/craftbukkit/util/ServerShutdownThread.java:[21] The method restore() is undefined for the type Terminal
[INFO] 3 errors 
[INFO] -------------------------------------------------------------
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 10.178 s
[INFO] Finished at: 2018-10-28T12:35:54+01:00
[INFO] Final Memory: 21M/559M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.7.0:compile (default-compile) on project craftbukkit: Compilation failure: Compilation failure: 
[ERROR] /Applications/spigotmc/CraftBukkit/src/main/java/org/bukkit/craftbukkit/command/ColouredConsoleSender.java:[50] The method isAnsiSupported() is undefined for the type Terminal
[ERROR] /Applications/spigotmc/CraftBukkit/src/main/java/net/minecraft/server/MinecraftServer.java:[593] The method restore() is undefined for the type Terminal
[ERROR] /Applications/spigotmc/CraftBukkit/src/main/java/org/bukkit/craftbukkit/util/ServerShutdownThread.java:[21] The method restore() is undefined for the type Terminal
[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/MojoFailureException
Exception in thread "main" java.lang.RuntimeException: Error running command, return status !=0: [sh, /Applications/spigotmc/apache-maven-3.5.0/bin/mvn, clean, install]
	at org.spigotmc.builder.Builder.runProcess0(Builder.java:673)
	at org.spigotmc.builder.Builder.runProcess(Builder.java:630)
	at org.spigotmc.builder.Builder.main(Builder.java:506)
	at org.spigotmc.builder.Bootstrap.main(Bootstrap.java:29)
commented

Also reported in Spigot: https://hub.spigotmc.org/jira/browse/BUILDTOOLS-426

It's not the last lines. It's near the top:

[ERROR] /Applications/spigotmc/CraftBukkit/src/main/java/org/bukkit/craftbukkit/command/ColouredConsoleSender.java:[50] The method isAnsiSupported() is undefined for the type Terminal

Probably something to do with the dependency. See https://jline.github.io/jline2/apidocs/reference/jline/Terminal.html#isAnsiSupported()

Check the Spigot source to see what is being imported for Terminal, and the pom.xml file for the project to see what version is specified.

commented

Hmmmm, I am also on Java 8. Build 51 instead of 131, but I would be surprised if that makes the difference

$ java -version
java version "1.8.0_51"
Java(TM) SE Runtime Environment (build 1.8.0_51-b16)
Java HotSpot(TM) 64-Bit Server VM (build 25.51-b03, mixed mode)
commented

It looks like Maven may be using the wrong version of the jline2 library. I would first try cleaning out the Maven cache (rm -rf ~/.m2/repository/) to see if things improve.

commented

Hmmmm..... I downloaded https://hub.spigotmc.org/jenkins/job/BuildTools/lastSuccessfulBuild/artifact/target/BuildTools.jar to try it out.

Works for me on OS X with Java 8.

$ java -version
java version "1.8.0_131"
Java(TM) SE Runtime Environment (build 1.8.0_131-b11)
Java HotSpot(TM) 64-Bit Server VM (build 25.131-b11, mixed mode)
Success! Everything compiled successfully. Copying final .jar files now.
Copying craftbukkit-1.12.2-R0.1-SNAPSHOT.jar to /Users/sitapati/workspace/spigot/./craftbukkit-1.12.2.jar
  - Saved as ./craftbukkit-1.12.2.jar
Copying spigot-1.12.2-R0.1-SNAPSHOT.jar to /Users/sitapati/workspace/spigot/./spigot-1.12.2.jar
  - Saved as ./spigot-1.12.2.jar
commented

Tried upgrading to java 1.8.0_192. Did not solve the problem

commented

I found the problem. For some unknown reason (or at least I do not remember) jline-0.9.94.jar existed in my /Library/Java/Extensions folder. jline 0.9.94 did not have the getAnsiSupported and restore methods. Removing jline-0.9.94.jar from /Library/Java/Extensions helped and I can now successfully run "java -var BuildTools.jar"

commented

I tried (re)moving my ~/.m2/repository before running again. Did not help. I even checked ~/.m2/repository/jline/jline/2.12.1/jline-2.12.1.jar afterwards, and the jline.Terminal class inside DOES contain getAnsiSupported and restore methods. During the BuildTools run it must be using jline.Terminal from somewhere else, or a patched version or something?
Can I run BuildTool.jar in verbose debug mode to see its classpath for compile?
Or any suggestions of how to proceed?