2017-01-18 27 views
0

私はMavenプロジェクトで耳を構築しています。そのファイルをいくつかのファイル(シェルスクリプトなど)を含むzipファイルにパッケージ化する必要があります。Mavenアセンブリ:エラー入力ファイルに複数のファイルがあります

私のプロジェクトは、次のようになります。

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

jar、sar、およびearはすべてビルドされています。耳には、他のサブモジュールの瓶とサールが入っています。さて、私がしなければならないことは、その耳に他のいくつかのファイルをパッケージ化し、それを圧縮することです。

元々アセンブリをfoo-parentに入れましたが、foo-parentがjar、sar、およびearをビルドする前にパッケージフェーズを実行していたという問題が発生しました。ちょっと読んで、私はサブモジュールの1つにアセンブリを置くように言われたので、私は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に変更しました。すべてがうまくいきました。

これはAssemblyプラグインのバグかもしれません。私は調査しなければならないでしょう。

関連する問題