我创建了一个包含 2 个模块(child1、child2)的多模块 maven 项目。
我正在尝试使用程序集插件创建一个包 - APP.zip,其中应包含 app.properties、child1.war 和 child2.war。
但是当我运行mvn assembly:single命令时出现以下错误
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-assembly-plugin:2.6:single (default-cli) on project app: Failed to create assembly: Error creating assembly archive My_Package: You must set at least one file. -> [Help 1]
项目文件夹结构
app
|
pom.xml
assembly.xml
app.properties
child 1
|
pom.xml src target
|
child1.war
child 2
|
pom.xml src target
|
child2.war
父 pom (app/pom.xml)
<project>
<groupId>com.karthik</groupId>
<artifactId>parent</artifactId>
<packaging>pom</packaging>
<version>1.0-SNAPSHOT</version>
<name>parent</name>
<modules>
<module>child 1</module>
<module>child 2</module>
</modules>
<build>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
<configuration>
<finalName>APP</finalName>
<appendAssemblyId>false</appendAssemblyId>
<descriptors>
<descriptor>assembly.xml</descriptor>
</descriptors>
</configuration>
<executions>
<execution>
<id>make-bundles</id>
<goals>
<goal>single</goal>
</goals>
<phase>package</phase>
</execution>
</executions>
</plugin>
</plugins>
</pluginManagement>
</build>
</project>
程序集.xml
<assembly
xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2 http://maven.apache.org/xsd/assembly-1.1.2.xsd">
<formats>
<format>zip</format>
</formats>
<id>My_Package</id>
<includeBaseDirectory>false</includeBaseDirectory>
<moduleSets>
<moduleSet>
<useAllReactorProjects>true</useAllReactorProjects>
<includes>
<include>com.karthik:child1</include>
<include>com.karthik:child2</include>
</includes>
</moduleSet>
</moduleSets>
</assembly>
我相信我错过了导致此错误的程序集描述符中的某些内容。
1) 您能否帮助解决这个问题并帮助创建一个包含 app.properties、child1.war 和 child2.war 的 zip(APP.zip)?
2)我们什么时候需要使用<fileSet>
&<moduleSet>
标签?