0

我有一个多模块 Maven 项目,我想将通过在单个模块上运行程序集插件创建的工件组合在一起。这可能吗?

4

2 回答 2

1

是的,可以使用项目依赖项来执行此操作,该依赖项可以详细阅读Maven Assembly Plugin的文档。

于 2010-09-29T15:29:36.770 回答
0

我想我已经通过在每个子模块的打包阶段运行程序集插件找到了自己问题的答案。这保证了当我在顶层项目上运行程序集时,所有子模块都会被组装。

我的顶级 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>
于 2010-09-29T15:39:01.800 回答