stigkj / gradle-executable-jar-plugin

ABANDONED - use something like the gradle-capsule-plugin instead
24 stars 3 forks source link

Build fails with Gradle M7 #10

Closed harschware closed 12 years ago

harschware commented 12 years ago

After adding the snippet from the README my otherwise working build produces the following error.

Caused by: java.lang.NoClassDefFoundError: org/gradle/internal/Factory at 
org.gradle.api.internal.AbstractClassGenerator.generate(AbstractClassGenerator.java:94)
    ... 52 more
Caused by: java.lang.ClassNotFoundException: org.gradle.internal.Factory
    ... 53 more

BUILD FAILED
harschware commented 12 years ago

To rule out side effects from my build I created a build.gradle containing only the suggested code from the README.md. I get the same error.

stigkj commented 12 years ago

hmm...strange. Do you have a complete stacktrace? This does not show any of my code. Just put -s on the gradle command line.

harschware commented 12 years ago

I just tested again, this time on my fairly virgin Mac Book Pro (previous test was on Win7 box). I got the output below. Do you maybe have some environment in your .gradle/init.gradle or something?

Tims-MacBook-Pro:gradle-license-test tharsch$ gradle build -s Download http://repo1.maven.org/maven2/net/nisgits/gradle/gradle-executable-jar-plugin/master-REL-5/gradle-executable-jar-plugin-master-REL-5.pom Download http://repo1.maven.org/maven2/net/nisgits/gradle/gradle-executable-jar-plugin/master-REL-5/gradle-executable-jar-plugin-master-REL-5.jar

FAILURE: Build failed with an exception.

BUILD FAILED

Total time: 4.744 secs

harschware commented 12 years ago

One more peg point for you: Running this gradle.build with gradle-M6 works, with M7 fails for the CommonsHttpClientResolver problem. Note this build is using REL-4. If I attempt to use REL-5 with gradle M6 it fails same as with M7.

apply plugin: 'executable-jar'

mainClass = 'call.with.Main'

buildscript {
    repositories {
        mavenCentral()
   }
    dependencies {
        classpath 'net.nisgits.gradle:gradle-executable-jar-plugin:master-REL-4'
   }
}
stigkj commented 12 years ago

Sorry about this. I have managed to build the release with a milestone-8 snapshot release of gradle. A new version (master-REL-6) built with milestone-7 is on it way up to Maven Central.

harschware commented 12 years ago

No problem, thanks for the great plugin.

eegasudheer commented 12 years ago

I try apply == > apply plugin: 'executable-jar' in my script . After executing below script, jar file generated successfully inside /build/libs. when I try to run the jar file I'm getting

Exception in thread "main" java.lang.NoClassDefFoundError: groovy/lang/GroovyObject at java.lang.ClassLoader.defineClass1(Native Method) at java.lang.ClassLoader.defineClass(Unknown Source) at com.simontuffs.onejar.JarClassLoader.defineClass(JarClassLoader.java:803) at com.simontuffs.onejar.JarClassLoader.findClass(JarClassLoader.java:710)

Below is the script

apply plugin: 'executable-jar'

mainClass = 'hello'

buildscript { repositories { mavenCentral() } dependencies {

    classpath 'net.nisgits.gradle:gradle-executable-jar-plugin:master-REL-6' , 'org.codehaus.groovy:groovy-all:1.7.10'      

} }

I'm running the jar with

java -jar

Not sure what was the the problem.

stigkj commented 12 years ago

Is this an application written in Groovy? Remember that the dependencies section inside the buildscript section is only for running the executable-jar plugin and won't be included in the resulting jar file.

And could you please move this to a new issue?