Tar task how to include files without existing directory structure


(Garth Connell) #1

I am creating a simple tar file to hold some configurations however I only want to add the files to the root of the tar however they are being added in their existing folders:

task ("conf-${release}-${environment}" , type: Tar) {

	archiveName = "conf-${buildNumber}-${environment}.tar"

	from('.') {
	include "${release}/${environment}/*"
	include "${release}/${environment}-environment/*"


	into ('/')
}

}


(Garth Connell) #2

This worked if anyone was interested:

	eachFile { fileCopyDetail ->

		fileCopyDetail.setPath fileCopyDetail.getName()

	}