gamma
gamma

Reputation: 1902

Gradle copy job fails on SMB-FS though file copied successfully

I have a copy job within my gradle build that will fetch files from a locally mounted SMB/CIFS system. It does copy the first file correctly but exits with Could not copy file exception and a hint on a native problem while getting the file mode. The files and directories have RWX for the current user. When copying the content into another local folder, the job works as expected.

The exception is:

Caused by: org.gradle.internal.nativeplatform.filesystem.FileException: Could not get file mode for '/mountpoint/file.zip'.
at org.gradle.internal.nativeplatform.filesystem.GenericFileSystem.getUnixMode(GenericFileSystem.java:58)
at org.gradle.api.internal.file.DefaultFileTreeElement.getMode(DefaultFileTreeElement.java:67)
at org.gradle.api.internal.file.AbstractFileTreeElement.copyTo(AbstractFileTreeElement.java:76)
... 78 more
Caused by: net.rubygrapefruit.platform.NativeException: Could not get posix file details of /mountpoint/file.zip: could not stat file (errno 75)
at net.rubygrapefruit.platform.internal.DefaultPosixFiles.stat(DefaultPosixFiles.java:32)
at net.rubygrapefruit.platform.internal.DefaultPosixFiles.getMode(DefaultPosixFiles.java:46)
at org.gradle.internal.nativeplatform.filesystem.NativePlatformBackedStat.getUnixMode(NativePlatformBackedStat.java:32)
at org.gradle.internal.nativeplatform.filesystem.GenericFileSystem.getUnixMode(GenericFileSystem.java:56)
... 80 more

The question is: is there a workaround? Some other way? Anything I can do to the system without changing the build script (too much)? (the solution should not be about creating a local copy first ...)

The System is a Debian machine with Java 1.7.65 and a Gradle 2.0 version

Upvotes: 2

Views: 806

Answers (1)

gamma
gamma

Reputation: 1902

The problem seems to be "well known" - though I did not find this at first: there is a bug report for Gradle already. I hope this will be fixed soon.

A solution that works in my case can only be achieved using good'ol ANT like so:

    ant.copy(todir:"destination/directory") {
        fileset(dir: "source/directory")
        {
            include(name: "filename.zip")
        }
    }

Upvotes: 1

Related Questions