2017-12-06 3 views
0

이 간단한 질문에 대해 미리 사과드립니다. 나는 Gradle에 비교적 새로운 기술입니다.gradle zip 작업에서 경로 정보를 제외하는 방법

내 빌드 프로세스 중에 Zip 작업을 실행하고 .zip 파일을 "보관"디렉터리에 있지만 원본 파일의 디렉터리 구조는 만들지 않습니다. 나는 그럭저럭 task 그러나 그 디렉토리 구조를 유지하면서 일할 수 있었다. 나는 리눅스 우편을 위해 디렉토리를 평평하게하는 옵션 -j 또는 -r가 있지만 이것이 Gradle 작업을 통해 나에게 사용 가능한지 확실하지 않다는 것을 읽었다.

./ 
./file1.jar 
./script1.sh 
./script2.sh 

내 현재의 우편 업무는 다음과 같다

My input file structures looks similar to the below, 
    ./libs/ 
    ./libs/file1.jar 
    ./scripts/script1.sh 
    ./scripts/script2.sh 

하지만 디렉토리 구조는 다음과 같이있는 Zip 파일로 끝날 싶습니다,

task makeZipForDeploy(type: Zip) { 
      from 'build/' 
      include 'libs/*' //to include all files in libs folder 
      include 'scripts/*' //to include all files in the scripts folder 
      archiveName("${archiveFileName}") 
      destinationDir file("${archivePath}") 
} 

답변

0

솔루션도했다 내가 생각했던 것보다 더 사소한. 아래의 구조를 평평하게됩니다

task makeZipForDeploy(type: Zip) { 
    from 'build/libs' //to include all files in libs folder 
    from 'build/scripts' //to include all files in the scripts folder 
    archiveName("${archiveFileName}") 
    destinationDir file("${archivePath}") 
} 
관련 문제