Java Gradle wrapper JAR is corrupt

I am not sure if it is just my Arch Linux environment, but the gradle-wrapper.jar is getting corrupted after I download the exercise.

The first sign of this is I get this output when after downloading the exercise:

efreet java/squeaky-clean » ./gradlew test                                                                        
Error: Could not find or load main class org.gradle.wrapper.GradleWrapperMain
Caused by: java.lang.ClassNotFoundException: org.gradle.wrapper.GradleWrapperMain

So then I checked a gradle-wrapper.jar:

efreet  concept/squeaky-clean ‹main*› » zip -T gradle/wrapper/gradle-wrapper.jar
        zip warning: expected 33 entries but found 32

zip error: Zip file structure invalid (gradle/wrapper/gradle-wrapper.jar)

Curious to know if the same thing happens for anyone else?

The corresponding Github issue:

Thanks for reporting this! I was able to reproduce your issue and merged a fix that updates the gradle-wrapper.jars for all exercises. My gut feeling says that it was caused by Git trying to convert CRLF to LF, but I’m not 100% sure.

@ErikSchierboom two things stood out to me while testing this:

  1. I can’t seem to get the updated files downloaded for exercises that I have downloaded before. The website doesn’t give me the option to update to the latest version, and redownloading with the CLI (normally and with --force) always gives me the same version that doesn’t work. Any idea why this happens?
  2. The gradlew file in the downloaded exercise doesn’t have the same permissions as on GitHub: it should be 0755 but after downloading it’s 0644. This causes ./gradlew test to complain, saying zsh: permission denied: ./gradlew. Again, any idea why this happens?
1 Like

I can confirm I no longer get the corrupt wrapper JAR, although I still have to set the permission on the gradlew script.

See Setup chmod for certain files in downloaded exercise. · Issue #903 · exercism/cli · GitHub for context. I’m not saying this shouldn’t be changed, but there has been a previous discussion before.