我有以下内容:
现在我需要以下内容:
如果不清楚,请告诉我们,所以我会提供更多细节。
非常感谢你。
答案 0 :(得分:0)
第一步是create a separate module类似mod-zip,它包含以下pom,它依赖于所有工件和maven-assembly-plugin的配置。
您必须以适当的方式将父级更改为您的父级:
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.soebes.maven.multiple.artifacts</groupId>
<artifactId>parent</artifactId>
<version>1.0.4-SNAPSHOT</version>
</parent>
<artifactId>mod-zip</artifactId>
<packaging>pom</packaging>
<name>Mod: ZIP</name>
<dependencies>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>mod-war1</artifactId>
<version>${project.version}</version>
<type>war</type>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>mod-war2</artifactId>
<version>${project.version}</version>
<type>war</type>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>mod-war3</artifactId>
<version>${project.version}</version>
<type>war</type>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>mod-ear1</artifactId>
<version>${project.version}</version>
<type>ear</type>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>mod-ear2</artifactId>
<version>${project.version}</version>
<type>ear</type>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
<executions>
<execution>
<id>test</id>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
<configuration>
<descriptors>
<descriptor>test.xml</descriptor>
</descriptors>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
其次你需要一个汇编描述符来描述你喜欢的东西,这有点棘手:
<assembly xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0 http://maven.apache.org/xsd/assembly-1.1.0.xsd">
<id>test</id>
<formats>
<format>zip</format>
</formats>
<includeBaseDirectory>false</includeBaseDirectory>
<dependencySets>
<dependencySet>
<unpack>true</unpack>
<useProjectArtifact>false</useProjectArtifact>
<includes>
<include>${project.groupId}:*:war:${project.version}</include>
</includes>
<unpackOptions>
<includes>
<include>images/**</include>
</includes>
</unpackOptions>
</dependencySet>
</dependencySets>
<moduleSets>
<moduleSet>
<useAllReactorProjects>true</useAllReactorProjects>
<includes>
<include>${project.groupId}:*:ear:${project.version}</include>
</includes>
<binaries>
<outputDirectory>result</outputDirectory>
<unpack>false</unpack>
</binaries>
</moduleSet>
</moduleSets>
</assembly>
棘手的事情是通过两个步骤。首先使用dependencySets过滤仅具有war
s的工件,并过滤掉来自它们的图像unpackOptions
。其次,您需要使用moduleSets来使用EAR模块。