0
我有一个多模块的Maven项目,并且我想通过在各个模块上运行程序集插件创建工件。这可能吗?在Maven多模块项目中,是否可以以递归方式应用程序集插件?
我有一个多模块的Maven项目,并且我想通过在各个模块上运行程序集插件创建工件。这可能吗?在Maven多模块项目中,是否可以以递归方式应用程序集插件?
我想我已经通过在每个子模块的包装阶段运行程序集插件找到了解决我自己问题的答案。这保证了当我在顶层项目上运行程序集时,所有子模块都将被组装。
我在顶层POM的插件配置是这样的:
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.quantel</groupId>
<artifactId>project-folders-modules</artifactId>
<version>1.0</version>
<packaging>pom</packaging>
<description>Collection of modules for project folders. </description>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<modules>
<module>db-controller</module>
</modules>
<build>
<plugins>
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<configuration>
<ignoreDirFormatExtensions>true</ignoreDirFormatExtensions>
<descriptors>
<descriptor>src/main/assembly/assembly.xml</descriptor>
</descriptors>
</configuration>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
是的,可以使用项目依赖项来完成这项工作,该项目依赖项可以详细阅读Maven Assembly Plugin的文档。