Create a task Execto change the file resolution. Add this to your build.gradlefile
task filepermission(type: Exec) {
commandLine 'chmod', '700', '<file_path>'
}
Run it using the block doLast. Your last build.gradlewill look like this:
task filepermission(type: Exec) {
commandLine 'chmod', '700', '<file_path>'
}
task fatJar(type: Jar) {
manifest {
attributes 'Implementation-Title': 'Gradle Jar File Example',
'Implementation-Version': version,
'Main-Class':'com.asd.App',
'Class-Path': 'com.asd'
}
baseName = project.name + '-all'
from {
configurations.compile.collect { it.isDirectory() ? it : zipTree(it) }
}
def file = file('/home/master/project/asd')
fileMode = 755
destinationDir = file
with jar
doLast {
filepermission.execute()
}
}
Now the launch gradle fatJarshould change the file resolution. Make sure you set the correct path in the taskfilePermission
source
share