Gradle + Jar (FatJar) : “Could not copy zip entry” error message

This problem is caused by https://discuss.gradle.org/t/ziptree-unable-to-overwrite-temporary-read-only-files/2322/3 resp. https://issues.gradle.org/browse/GRADLE-2959

Solution is to add delete command which removes folder ./tmp/expandedArchives:


jar {
  delete "$buildDir/tmp/expandedArchives"

  from {
    (configurations.runtime).collect {
      it.isDirectory() ? it : zipTree(it)
    }
  }

  manifest {
    attributes("Main-Class": "com.test.Main" )
    }
  }

Advertisements

One thought on “Gradle + Jar (FatJar) : “Could not copy zip entry” error message

  1. Pingback: Gradle: Spring + FatJar = dependency on Internet connection | Jaroslav Kubos

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s