This is my gradle build script.
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'
}
And this compiles just fine
The problem is that I can’t run the created JAR, I get an exception
java.lang.NoClassDefFoundError: groovy/lang/GroovyObject
So I guess the groovy plugin doesn’t include all the necessary classes inside the JAR.
How to I create a stand-alone JAR that I can simply .. run 😉
What you are looking for is the application plugin which allows you build a standalone JVM application including all dependencies and run scripts.
EDIT:
This should create the uberjar you want: