2017-03-08 7 views
1

중국어로 된 폴더 이름이 포함 된 Zipfile이 있습니다.중국 파일 이름에 Gradle ziptree가 표시되지 않습니다.

ZipFile를 리눅스 압축 해제, 윈도우 WinRAR과 및 7zip과를 사용하여 아무 문제없이 추출 할 수

Gradles "ziptree"를 사용하는 경우 항상 다음과 같은 오류 얻을 :

Could not expand ZIP '/pathToZip/myZip.zip'. 

스택 트레이스는 말한다 :

Caused by: org.gradle.api.GradleException: Could not copy zip entry /pathToZip/myZip.zip!somefolderstructure/??/ to '/destination/somefolderstructure/??'. 
    at org.gradle.api.internal.file.AbstractFileTreeElement.copyTo(AbstractFileTreeElement.java:79) 
    at org.gradle.api.internal.file.copy.DefaultFileCopyDetails.copyTo(DefaultFileCopyDetails.java:106) 
    at org.gradle.api.internal.file.copy.FileCopyAction$FileCopyDetailsInternalAction.processFile(FileCopyAction.java:44) 
    at org.gradle.api.internal.file.copy.SyncCopyActionDecorator$1$1.processFile(SyncCopyActionDecorator.java:59) 
    at org.gradle.api.internal.file.copy.NormalizingCopyActionDecorator$1.maybeVisit(NormalizingCopyActionDecorator.java:98) 
    at org.gradle.api.internal.file.copy.NormalizingCopyActionDecorator$1.access$000(NormalizingCopyActionDecorator.java:53) 
    at org.gradle.api.internal.file.copy.NormalizingCopyActionDecorator$1$1.processFile(NormalizingCopyActionDecorator.java:65) 
    at org.gradle.api.internal.file.copy.DuplicateHandlingCopyActionDecorator$1$1.processFile(DuplicateHandlingCopyActionDecorator.java:60) 
    at org.gradle.api.internal.file.copy.CopyFileVisitorImpl.processFile(CopyFileVisitorImpl.java:62) 
    at org.gradle.api.internal.file.copy.CopyFileVisitorImpl.visitFile(CopyFileVisitorImpl.java:46) 
    at org.gradle.api.internal.file.AbstractFileTree$FilteredFileTreeImpl$1.visitFile(AbstractFileTree.java:181) 
    at org.gradle.api.internal.file.archive.ZipFileTree.visit(ZipFileTree.java:91) 
    ... 97 more 
Caused by: org.gradle.internal.nativeintegration.filesystem.FileException: Could not set file mode 755 on '/destination/somefolderstructure/??'. 
    at org.gradle.internal.nativeintegration.filesystem.services.GenericFileSystem.chmod(GenericFileSystem.java:89) 
    at org.gradle.api.internal.file.AbstractFileTreeElement.copyTo(AbstractFileTreeElement.java:76) 
    ... 108 more 
Caused by: net.rubygrapefruit.platform.NativeException: Could not set UNIX mode on /destination/somefolderstructure/??: could not convert string to current locale 
    at net.rubygrapefruit.platform.internal.DefaultPosixFiles.setMode(DefaultPosixFiles.java:61) 
    at org.gradle.internal.nativeintegration.filesystem.services.NativePlatformBackedChmod.chmod(NativePlatformBackedChmod.java:33) 
    at org.gradle.internal.nativeintegration.filesystem.services.GenericFileSystem.chmod(GenericFileSystem.java:87) 
    ... 109 more 

이미 gradle.properties에서 파일 인코딩을 설정하려고했습니다.

.4.1 및 2.14

아무것도 작동 :

file.encoding=utf-8 

나는 나는 또한 다른 Gradle을 버전을 시도한 Gradle을 매개 변수

-Dfile.encoding=utf-8 

을 추가했습니다.

UPDATE 여기

내 build.gradle (I 수동으로 스택 트레이스를 수정하기 때문에 경로가 스택 트레이스 일치하지 않는) :

apply plugin: 'maven' 

def defaultEncoding = 'UTF-8' 
tasks.withType(AbstractCompile).each { 
    it.options.encoding = defaultEncoding 
} 
tasks.withType(GroovyCompile).each { 
    it.groovyOptions.encoding = defaultEncoding 
} 

configurations { 
    mydependencies 
} 

dependencies { 
    mydependencies 'my.group:my-artifact:[email protected]' 
} 

task copyArtifact(type: Copy) { 
    from configurations.mydependencies 
    into "$buildDir/zip" 
} 

task extractZip(type: Sync) { 
    from zipTree("$buildDir/zip/my-artifact.zip") 
    into "$buildDir/xtract" 
} 

어떤 아이디어가?

마지막 해결책은 zip을 수정하는 것입니다.

답변

0

지금까지 중국의 폴더 만 노드 서브 모듈 (https://github.com/jfhbrook/node-ecstatic/tree/master/test/public/%E4%B8%AD%E6%96%87) 나는 내 복사 작업에서 "제외"를 사용하여 테스트 목적을위한 같이 매우 빠른 응답을위한

task extractDependency(type: Copy) { 
    from zipTree(configurations.mydependencies) 
    into "$buildDir/xtract" 
    exclude "$parentFolder/npm/node_modules/http-server/node_modules/ecstatic/test/public/" 
} 
0

어때? -Dfile.encoding=UTF-8은 그래 플의 인코딩 자체이지만 인코딩을 컴파일하는 데는 영향을 미치지 않습니다. build.gradle에서 사용하십시오.

def defaultEncoding = 'UTF-8' 
tasks.withType(AbstractCompile).each { 
    it.options.encoding = defaultEncoding 
} 
tasks.withType(GroovyCompile).each { 
    it.groovyOptions.encoding = defaultEncoding 
} 
+0

감사합니다 : -) 그러나 컴파일 작업에서 zip이 필요하지 않기 때문에 동기화 작업이 작동하지 않습니다. 다음 매개 변수를 사용하여 tasks.withType을 시도했습니다. 복사, 동기화, AbstractCopyTask - 아무런 차이가 없습니다. –

+0

(업데이트 된 질문을 읽지 않아서 메모를 삭제합니다.) – tkhm

+1

이것은 답변이 아니지만 도움이 될 수 있습니다. [Project.zipTree()에 대한 metadataCharset 지원 · 이슈 # 1363 · gradle/gradle · GitHub] (https://github.com/gradle/gradle/issues/1363) – tkhm