在我的Eclipse项目中,我在src/main/clojure/ext/clojuretest/helloworld.clj
中有以下Clojure代码:
(ns ext.clojuretest.helloworld)
;; https://clojuredocs.org/clojure.core/gen-class
(gen-class
:name "ext.clojuretest.HelloWorld"
:prefix "java-"
:main true)
(defn java-main [& args]
"I can say 'Hello World'."
(println "Hello, World from Clojure!"))
;;(.println (System/out) "Hello, World from Java!"))
我想在同一个项目中使用Java代码中的类:src/main/java/ext/clojuretest/ClojureTest.java
:
package ext.clojuretest;
public class ClojureTest {
public static void main(String[] args) {
HelloWorld h = new HelloWorld();
}
}
我正在使用Gradle构建我的项目(build.gradle
):
plugins {
id "de.kotka.clojuresque.clojure" version "2.0.0"
}
repositories {
mavenCentral()
}
dependencies {
compile 'org.clojure:clojure:1.8.0'
}
clojure.aotCompile = true
是否可以在我的Java代码中使用类HelloWorld
?目前,编译器找不到HelloWorld
HelloWorld cannot be resolved to a type