Caused by: java.lang.ClassNotFoundException: org.gradle.wrapper.GradleWrapperMain

(Bayo Erinle) #1

When trying to use the gradle wrapper, I keep getting the error above.

Here is my build file

apply plugin: 'war'
apply plugin: 'groovy'
apply plugin: 'idea'
apply plugin: 'jetty'
apply plugin: 'project-report'
  basePackageDir = 'com/mycompany/someproject'
  allprojects {
 sourceCompatibility = 1.6
  idea {
  project {
    jdkName = '1.6'
    languageLevel = '1.5'
  jettyRun {
    httpPort = 9090
    stopKey = 'pa$$!'
  [compileJava, compileTestJava]*.options*.compilerArgs = ['-Xlint:all']
  task wrap( type: Wrapper ) { gradleVersion = '1.0-milestone-7' }

Steps: > gradle wrap > ./gradlew clean

Then, I get the error.

I can however run gradle alone. i.e. gradle clean

Gradle Info: ------------------------------------------------------------ Gradle 1.0-milestone-7 ------------------------------------------------------------

Gradle build time: Thursday, January 5, 2012 10:24:43 AM UTC Groovy: 1.8.4 Ant: Apache Ant™ version 1.8.2 compiled on December 20 2010 Ivy: 2.2.0 JVM: 1.6.0_29 (Sun Microsystems Inc. 20.4-b02) OS: Windows 7 6.1 x86

Please advice.


(Adam Murdoch) #2

Do you have a stacktrace for the failure? You can run with the --stacktrace option to get a stacktrace.

(Bayo Erinle) #3

Adam - running ./gradlew --stacktrace clean yields the same error.

It is as though, it can’t find the gradle executable.

I am running cygwin on windows.

I have narrowed it down to this.

Running ./gradlew in the cygwin shell doesn’t work.

However, running ./gradlew.bat works just fine.

I have run this things this way and only started hitting this errors when I re-created the wrapper with the new milestone.

Any clues?

(Peter Niederwieser) #4

Can you just post the complete output you get (unchanged)?

From my experience, running Gradle in cygwin is problematic. For example, I’ve been seeing a tenfold increase in startup time compared to the command prompt. I don’t know who’s to blame for this.

(James Owen) #5

Thanks David, I’ve just wasted a whole day wondering why I was getting this error. Feel like a complete idiiot now!

(David Sanders) #6

I was getting this too - I found that I hadn’t committed the gradle/wrapper/gradle-wrapper.jar, due to jars being on my git ignore list.

‘git add -f gradle/wrapper/gradle-wrapper.jar’ did the trick.