EDIT: Other discussions are underway related to this issue on Bukkit forums and on Github .
So, I know that one or two people tried to do this without any luck. But I think I'm almost there.
One problem: I donβt know Java, so for me this is a bit foreign. Anyway..
So, I made a simple class in Clojure as follows:
(ns com.gdude2002.ClojurePlugin.mainclj (:gen-class :name com.gdude2002.ClojurePlugin.mainclj :extends org.bukkit.plugin.java.JavaPlugin) (:import org.bukkit.plugin.java.JavaPlugin)) (defn -onEnable [this] (java.util.logging.Logger/getLogger "Loaded clojure plugin!")) (defn -onDisable [this] (java.util.logging.Logger/getLogger "Unloaded clojure plugin!"))
I am using the clojure compile function to compile this Java class as follows.
(set! *compile-path* ".") (compile 'com.gdude2002.ClojurePlugin.mainclj)
Then I put it in the jar manually, in com / gdude2002 / ClojurePlugin / mainclj.class (as well as inserting plugin.yml in the root directory).
So far so good. This method does not make a bukkit bitch about my code (in particular), which I think is good. Now about the problem.
When I try to start the server with this manual box, I get the following output.
21:43:30 [SEVERE] Could not load 'plugins\plugin.jar' in folder 'plugins' org.bukkit.plugin.InvalidPluginException: java.lang.NoClassDefFoundError: clojure/lang/IFn
"So," I think, "it seems simple enough - he can't find Clojure, right?" So, I put the clojure jar in all kinds of places with the same error. I also add META-INF / MANIFEST.MF to the jar containing Class-Path: ../lib . Still nothing.
So, thinking that I was smart, I pulled out the clojure folder from the clojure banner and ran it in mine, also putting the folder in .. / lib and other places that I thought this might help.
Now I get this error.
21:51:33 [SEVERE] Could not load 'plugins\plugin.jar' in folder 'plugins' org.bukkit.plugin.InvalidPluginException: java.lang.ExceptionInInitializerError ... Caused by: java.io.FileNotFoundException: Could not locate clojure/core__init.class or clojure/core.clj on classpath: ...
The fact is that both of these things exist, as far as I can judge.
EDIT: Decided to show the code of the decompiled class here, in case someone helps.
// IntelliJ API Decompiler stub source generated from a class file // Implementation of methods is not available package com.gdude2002.ClojurePlugin; public class mainclj extends org.bukkit.plugin.java.JavaPlugin { private static final clojure.lang.Var main__var; private static final clojure.lang.Var onEnable__var; private static final clojure.lang.Var getResource__var; private static final clojure.lang.Var onLoad__var; private static final clojure.lang.Var getLogger__var; private static final clojure.lang.Var saveDefaultConfig__var; private static final clojure.lang.Var getDescription__var; private static final clojure.lang.Var removeDDL__var; private static final clojure.lang.Var onDisable__var; private static final clojure.lang.Var isInitialized__var; private static final clojure.lang.Var saveResource__var; private static final clojure.lang.Var onCommand__var; private static final clojure.lang.Var getDefaultWorldGenerator__var; private static final clojure.lang.Var toString__var; private static final clojure.lang.Var getDataFolder__var; private static final clojure.lang.Var installDDL__var; private static final clojure.lang.Var getDatabase__var; private static final clojure.lang.Var getFile__var; private static final clojure.lang.Var getClassLoader__var; private static final clojure.lang.Var getCommand__var; private static final clojure.lang.Var getDatabaseClasses__var; private static final clojure.lang.Var getConfig__var; private static final clojure.lang.Var reloadConfig__var; private static final clojure.lang.Var clone__var; private static final clojure.lang.Var setEnabled__var; private static final clojure.lang.Var saveConfig__var; public mainclj() { /* compiled code */ } public java.io.File getDataFolder() { /* compiled code */ } public boolean onCommand(org.bukkit.command.CommandSender p0, org.bukkit.command.Command p1, java.lang.String p2, java.lang.String[] p3) { /* compiled code */ } public void reloadConfig() { /* compiled code */ } public org.bukkit.configuration.file.FileConfiguration getConfig() { /* compiled code */ } public java.io.File getFile() { /* compiled code */ } public void saveConfig() { /* compiled code */ } public org.bukkit.command.PluginCommand getCommand(java.lang.String p0) { /* compiled code */ } public void onEnable() { /* compiled code */ } public java.util.logging.Logger getLogger() { /* compiled code */ } public void onLoad() { /* compiled code */ } public java.lang.ClassLoader getClassLoader() { /* compiled code */ } public void saveDefaultConfig() { /* compiled code */ } public org.bukkit.plugin.PluginDescriptionFile getDescription() { /* compiled code */ } public com.avaje.ebean.EbeanServer getDatabase() { /* compiled code */ } public void removeDDL() { /* compiled code */ } public void onDisable() { /* compiled code */ } public boolean isInitialized() { /* compiled code */ } public org.bukkit.generator.ChunkGenerator getDefaultWorldGenerator(java.lang.String p0, java.lang.String p1) { /* compiled code */ } public void installDDL() { /* compiled code */ } public void saveResource(java.lang.String p0, boolean p1) { /* compiled code */ } public java.util.List getDatabaseClasses() { /* compiled code */ } public java.lang.String toString() { /* compiled code */ } public java.lang.Object clone() { /* compiled code */ } public void setEnabled(boolean p0) { /* compiled code */ } public java.io.InputStream getResource(java.lang.String p0) { /* compiled code */ } public static void main(java.lang.String[] p0) { /* compiled code */ } }
EDIT: The comments stated that I should publish the project.clj file. The fact is that I do not have it! I run compile.clj on mainclj.clj directly and create jarfile manually.
At this moment, I am completely at a standstill. Anyone have any ideas on this?