[BUG] the generated gradlew file does not have the correct permission
Created by: jmini
The gradlew
file in the generated project (like in samples/
) is wrong.
If you run .gradlew build
in samples/client/petstore/java/okhttp-gson
you get:
-bash: ./gradlew: Permission denied
Workaround: run chmod +x gradlew
before starting gradle.
I think gradlew
is a supporting file. We probably need something like this after generation.
private void setExecutable(Path file) throws IOException {
Set<PosixFilePermission> perms = new HashSet<PosixFilePermission>();
//add owners permission
perms.add(PosixFilePermission.OWNER_READ);
perms.add(PosixFilePermission.OWNER_WRITE);
perms.add(PosixFilePermission.OWNER_EXECUTE);
//add group permissions
perms.add(PosixFilePermission.GROUP_READ);
//add others permissions
perms.add(PosixFilePermission.OTHERS_READ);
Files.setPosixFilePermissions(Paths.get(file).getAbsolutePath()), perms);
}