OS Portability Issue using Gradle 2.8


(Mike Smithson) #1

I am not sure if this has been resolved in later versions or not but we have a had an issue where we were trying to add resource files to an ear as below:

ear {
    archiveName = "${project.name}.ear"
    from('/META-INF') {
            include '*.*'
            into '/META-INF'
        }

        from('/resources/properties/common') {
            include '*.properties'
            into '/properties'
        }
    }

when we ran our build on a Windows machine, everything seemed to work fine. After checking in our code and then running the same build in CI on a Linux machine, those resource files were suspiciously missing. After some head-scratching, we came up with this (removing the forward-slashes):

ear {
    archiveName = "${project.name}.ear"

    from('META-INF') {
        include '*.*'
        into 'META-INF'
    }

    from('resources/properties/common') {
        include '*.properties'
        into 'properties'
    }
}

I would not expect this behavior as it smells of some OS-specific workaround that we shouldn’t have to know or be aware of.


(Schalk Cronjé) #2

I would think it not be a Gradle bug, but purely a case of how java.io.File behaves.