Questo è il mio script di gradle build.Creare un JAR eseguibile Groovy con Gradle
apply plugin: 'groovy'
project.group = "test.tree"
archivesBaseName = "tree"
project.version = "1.0"
manifest.mainAttributes("Main-Class" : "test.tree.App")
sourceCompatibility=1.6
targetCompatibility=1.6
repositories {
mavenCentral()
}
dependencies {
groovy group: 'org.codehaus.groovy', name: 'groovy', version: '1.8.6'
testCompile group: 'junit', name: 'junit', version: '4.8.2'
}
E questo compila bene
Il problema è che non posso correre il JAR creato, ottengo un'eccezione java.lang.NoClassDefFoundError: groovy/lang/GroovyObject
quindi credo che il plugin Groovy non include tutti le classi necessarie all'interno del JAR.
Come posso creare un JAR standalone che posso semplicemente .. ;-) correre
Dopo aver letto tutti i suggerimenti da qui e anche utilizzando http://github.com/AvatarQing/groovy-executable-jar-with-gradle-example, ho creato un file jar che accetta uno script groovy e crea un jar eseguibile: https://github.com/krishnact/uberifier. Il file jar è: https://github.com/krishnact/uberifier/blob/master/bin/Uberifier-1.0.0.jar?raw=true – Krishna