Using gradle/clojuresq to build clojure

后端 未结 2 1165
醉酒成梦
醉酒成梦 2021-01-14 01:37

I\'m trying to use gradle/Clojuresque to build clojure code, run it, and get uberjar. I use hints from http://dev.clojure.org/display/doc/Getting+Started+with+Gradle, https

2条回答
  •  离开以前
    2021-01-14 01:43

    You're missing maven central repository:

    buildscript {
        repositories { 
            maven { url "http://clojars.org/repo" } 
            mavenCentral()
        }
        dependencies {
            classpath "clojuresque:clojuresque:1.7.0" 
        }
    }
    
    apply plugin: 'clojure'
    
    clojure.aotCompile = true
    
    repositories {
        flatDir dirs: project.file("lib/runtime")
        maven { url "http://clojars.org/repo" }
        mavenCentral()
    }
    
    dependencies {
        compile "org.clojure:clojure:1.6.0" 
    }
    

    And you both modify gradle source sets or move hello/core.clj to src/main/clojure where gradle by default looks for sources. With these changes jar file is generated and can be run when valid cp provided - I've no clojure installed so can't check it easily.

    EDIT

    Here a sample project can be found that has all the changes I introduced. It also produces uber jar with shadowJar task that has clojure dependency built-in and can enables hello.core to be run with the following command:

    java -cp build/libs/29015575-all.jar hello.core 
    

    EDIT2

    Now the github example produces runnable jar.

提交回复
热议问题