2016-06-25 1 views
1

Java 코드가 일부 파일을 생성했으며 내부적으로 zip으로 복사하려고했습니다. 그러나 일부 파일을 제외한 모든 파일이 복사됩니다. 나는 그 이유를 알 수 없다.생성 된 파일은 어셈블리 플러그인을 사용하여 Maven 프로젝트 zip으로 복사되지 않습니다.

내가 권한으로 복사하려고 시도한 폴더의 디렉토리 구조와 대상 폴더 (zip 파일)에 정확히 복사 된 내용을 추가 중입니다. 받는다는 플러그인을 사용하여 우편에서 모든 파일을 복사하려고

 

XYZ-MacBook-Pro:etl_configs XYZ$ pwd 
FILE_PATH_LOCATION/etl_configs 

XYZ-MacBook-Pro:etl_configs XYZ$ ls -l * 
-rw-r--r-- 1 XYZ staff 980 Jun 26 01:02 etl-spec.json 
-rwxr-xr-x 1 XYZ staff 2037 Jun 15 19:04 etl-without-transformation.json 

feeds: 
total 16 
-rw-r--r-- 1 XYZ staff 612 Jun 26 00:54 feed_1.json 
-rw-r--r-- 1 XYZ staff 616 Jun 26 01:02 feed_2.json 

tables: 
total 16 
-rw-r--r-- 1 XYZ staff 878 Jun 26 00:54 table_1.json 
-rw-r--r-- 1 XYZ staff 880 Jun 26 01:02 table_2.json 

-

디렉토리 구조와 권한.

<plugin> 
    <groupId>org.apache.maven.plugins</groupId> 
    <artifactId>maven-assembly-plugin</artifactId> 
    <version>2.5.5</version> 
    <configuration> 
     <descriptor>${project.basedir}/zip.xml</descriptor> 
    </configuration> 
    <executions> 
     <execution> 
      <id>make-assembly</id> 
      <phase>package</phase> 
      <goals> 
       <goal>single</goal> 
      </goals> 
     </execution> 
    </executions> 
</plugin> 

zip.xml 파일이 포함 -

<fileSet> 
     <directory>${project.basedir}/etl_configs</directory> 
     <outputDirectory>/etl_configs</outputDirectory> 
     <includes> 
       <include>*</include> 
     </includes> 
</fileSet> 

대상 zip 파일이 이상적으로는 내부 지퍼 폴더 전체를 복사해야

XYZ-MacBook-Pro:etl-without-transformation-template-1.0-SNAPSHOT XYZ$ pwd 
FILE_PATH_LOCATION/target/etl-without-transformation-template-1.0-SNAPSHOT-zip/etl-without-transformation-template-1.0-SNAPSHOT 
XYZ-MacBook-Pro:etl-without-transformation-template-1.0-SNAPSHOT XYZ$ ls -l etl_configs/* 
-rwxr-xr-x 1 XYZ staff 980 Jun 26 01:02 etl_configs/etl-spec.json 
-rwxr-xr-x 1 XYZ staff 2037 Jun 15 19:04 etl_configs/etl-without-transformation.json 

etl_configs/feeds: 

etl_configs/tables: 

을 contains-. 그러나 그것은 일어나지 않습니다.

답변

1

어셈블리 설명자 안에 <includes>을 사용하는 방식과 관련된 문제입니다. "etl_configs 아래에있는 모든 파일을 포함": 현재 의미

<fileSet> 
    <directory>${project.basedir}/etl_configs</directory> 
    <outputDirectory>/etl_configs</outputDirectory> 
    <includes> 
     <include>*</include> 
    </includes> 
</fileSet> 

를 사용합니다. "etl_configs 아래의 모든 파일을 재귀 적으로 포함"을 의미하지는 않습니다. 이것은 <include>*</include>을 사용하고 있기 때문입니다. maven-assembly-plugin은 앤트 스타일 패턴을 사용하고, 앤트에서는 * matches zero or more characters within a path name을 사용하며 디렉토리 경계를 넘지 않습니다. 이와 같이

, 재귀 적으로 모든 파일을 포함, 당신은 사용할 수 있습니다

<fileSet> 
    <directory>${project.basedir}/etl_configs</directory> 
    <outputDirectory>/etl_configs</outputDirectory> 
    <includes> 
     <include>**</include> 
    </includes> 
</fileSet> 

그러나, this is the default behaviour을 : <include> 하위 요소가 존재하는 경우

, 그들은 포함 할 파일 및 디렉토리의 집합을 정의 . 아무 것도 없으면 <includes>은 모든 유효한 값을 나타냅니다.

그래서 당신은 할 수 있습니다 :

<fileSet> 
    <directory>${project.basedir}/etl_configs</directory> 
    <outputDirectory>/etl_configs</outputDirectory> 
</fileSet> 
+0

그것은했다. 감사. – devsda

관련 문제