2017-01-18 5 views
0

나는 귀를 만드는 메이븐 프로젝트가 있습니다. 그런 다음 몇 가지 다른 파일 (셸 스크립트 등)이 포함 된 zip 파일로 해당 파일을 패키징해야합니다.메이븐 어셈블리 : 오류 입력 된 파일이 두 개 이상입니다.

내 프로젝트는 다음과 같습니다

  • foo-parent
    • foo-jar
    • foo-sar
    • foo-ear

항아리, sar 및 귀가 모두 생성됩니다. 귀에는 다른 하위 모듈의 항아리와 상처가 들어 있습니다. 자, 내가해야 할 일은 그 귀를 다른 몇 개의 파일들로 묶고 지퍼로 묶는 것뿐입니다.

원래 어셈블리를 foo-parent에 넣었지만 foo-parent은 jar, sar 및 ear를 빌드하기 전에 패키지 단계를 실행하고있는 문제에 부딪혔습니다. 조금 읽으면서 서브 어셈블리 중 하나에 어셈블리를 넣으라고 들었으므로 foo-ear을 골랐습니다.

지금 오류가 점점 오전 :

Failed to execute goal org.apache.maven.plugins:maven-assembly-plugin:2.6:single 
(foo-services-zip) on project foo-ear: Failed to create assembly: 
Error creating assembly archive foo-services-dist: There is more 
than one file in input. 

을 나는 There is more than one file in input 무엇을 의미하는지 모르겠습니다.

foo-ear POM은 다음과 같습니다

<assembly> 
    <id>foo-zip</id> 
    <formats> 
     <format>gzip</format> 
    </formats> 
    <includeBaseDirectory>true</includeBaseDirectory> 
    <fileSets> 
     <fileSet> 
      <directory>src/dist-files</directory> 
      <outputDirectory></outputDirectory> 
     </fileSet> 
    </fileSets> 
    <moduleSets> 
     <moduleSet> 
      <useAllReactorProjects>true</useAllReactorProjects> 
      <includes> 
       <include>com.vegicorp.foo:foo-ear</include> 
      </includes> 
      <binaries> 
       <includeDependencies>false</includeDependencies> 
       <outputDirectory>data/ear-dir</outputDirectory> 
       <unpack>true</unpack> 
      </binaries> 
     </moduleSet> 
    </moduleSets> 
</assembly> 

예, 난 그냥 <file> 또는 다른 <fileSet>를 사용할 수 알지만, 귀가 필요 :

<project> 
    <modelVersion>4.0.0</modelVersion> 

    <parent> 
     <groupId>com.vegicorp.foo</groupId> 
     <artifactId>foo-parent</artifactId> 
     <version>1.0.0</version> 
     <relativePath>..</relativePath> 
    </parent> 
    <artifactId>foo-ear</artifactId> 
    <packaging>ear</packaging> 
    <build> 
     <plugins> 
      <plugin> 
       <groupId>org.apache.maven.plugins</groupId> 
       <artifactId>maven-ear-plugin</artifactId> 
       <version>2.10.1</version> 
       [...] 
      </plugin> 
      <plugin> 
       <groupId>org.apache.maven.plugins</groupId> 
       <artifactId>maven-assembly-plugin</artifactId> 
       <executions> 
        <execution> 
         <id>build-foo-zip</id> 
         <phase>package</phase> 
         <goals> 
          <goal>single</goal> 
         </goals> 
         <configuration> 
          <descriptors> 
           <descriptor>src/assembly/foo-zip.xml</descriptor> 
          </descriptors> 
         </configuration> 
        </execution> 
       </executions> 
      </plugin> 
     </plugins> 
    </build> 
    <dependencies> 
    [...] 
    </dependencies> 
</project> 

src/assembly/foo-zip.xml 파일은 다음과 같습니다 gzip 파일의 압축을 풀어야하므로 <moduleSets>을 사용해야합니다. <binary> 또는 어떻게 <moduleSets>이 작동하는지 잘 모르겠다. 내 오류가 그 구성 어딘가에 있다고 생각합니다.

답변

0

발견. 어셈블리 파일의 형식은 gzip입니다. 이것은 실제로 잘못된 형식이지만 어셈블리에서는 여전히 사용합니다. 어셈블리에 둘 이상의 파일이있는 경우 어셈블리가 실패합니다. 형식을 zip으로 변경했는데 모든 것이 작동합니다. 문제라고 생각했던 모듈을 포함하여.

아마도 어셈블리 플러그인의 버그 일 수 있습니다. 조사 할게.