我有一个构建Ear的Maven项目。然后我们需要将这个耳朵包装成一个带有一些其他文件(shell脚本等)的zip文件。Maven Assembly:Error输入中有多个文件
我的项目是这样的:
foo-parent
foo-jar
foo-sar
foo-ear
罐子,沙拉和耳朵都在建造。耳朵包含来自其他子模块的罐子和瓶子。现在,我所要做的就是将其他几个文件打包并压缩。
本来,我把程序集放在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看起来是这样的:
<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
文件看起来像这样:
<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>
,但耳朵需要解压缩到gzip文件中,所以我需要使用<moduleSets>
。我不知道如何<binary>
或<moduleSets>
如何工作,我相信我的错误是在该配置中的某个地方。