Jaroslav Kuboš Jaroslav Kuboš I prefer to discover a causality rather than become a king of Persia. --Democritus

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

12.11.2015

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" ) 
    } 
}

Tagy: Gradle, Java, FatJar