我正在使用Maven Assembly插件构建我们的Web应用程序。这是因为需要从特殊插件中提取一些数据。汇编描述符的片段证明了这一点:
<dependencySet>
<unpack>true</unpack>
<scope>runtime</scope>
<useProjectArtifact>false</useProjectArtifact>
<includes>
<include>org.myproject.module:*:jar</include>
</includes>
<unpackOptions>
<includes>
<include>images/**</include>
<include>install/**</include>
<include>mappings/**</include>
</includes>
</unpackOptions>
<outputDirectory>./WEB-INF/myproject-modules/${artifact.name}</outputDirectory>
</dependencySet>
所有带有groupId = org.myproject.module的插件都有这种特殊处理和模块特定文件夹的提取。
现在,我需要使用完全相同的方法构建另一个WAR,但不同的模块集。有没有什么方法可以很好地扩展我的原始POM,只需添加依赖项,,而无需拥有我的程序集描述符的副本(存储在src / main / assembly中)?
简单地扩展pom失败,缺少程序集描述符,它在父级中实际找到:
<build>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
<version>2.3</version>
<configuration>
<descriptors>
<descriptor>src/main/assembly/assembly.xml</descriptor>
</descriptors>
</configuration>
<executions>
<execution>
<id>make-assembly</id>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
</plugin>
</plugins>
</build>