我有这样的项目结构
build.gradle
root buildscript {
dependencies {
classpath "clojuresque:clojuresque-base:$clojuresqueVersion"
}
repositories {
jcenter()
maven { url 'http://clojars.org/repo' }
}
}
allprojects {
apply plugin: 'idea'
repositories {
mavenCentral()
jcenter()
}
group='com.lapots.functional'
}
看起来像这样
build.gradle
子项目apply plugin: 'clojure-min'
clojure {
aotCompile = true
warnOnReflection = true
}
repositories {
clojarsRepo()
}
dependencies {
compile "org.clojure:clojure:$clojureVersion"
}
看起来像这样
clojure
我有简单的script.clj
脚本(ns com.lapots.functional.clojure.script)
(defn -main [& args]
(println "Hello, world!"))
{{1}}
但是如何用gradle运行呢?
答案 0 :(得分:0)
我选择了那个解决方案。
添加了:gen-class
。
(ns com.lapots.functional.clojure.script
(:gen-class))
(defn -main [& args]
(println "Hello, world!"))
创建了gradle
任务
task runClojure(dependsOn: classes, type: JavaExec) {
main = 'com.lapots.functional.clojure.script'
classpath = sourceSets.main.runtimeClasspath
}
然后用gradle runClojure
运行它。