【问题标题】:In a Maven multi-modules project, is it possible to apply the assembly plug-in in a recursive manner?在Maven多模块项目中,是否可以递归方式应用程序集插件?
【发布时间】:2010-09-29 15:04:15
【问题描述】:

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

【问题讨论】:

    标签: maven-2 assemblies module maven-assembly-plugin


    【解决方案1】:

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

    【讨论】:

      【解决方案2】:

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

      我的顶级 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>
      

      【讨论】:

        猜你喜欢
        • 2014-07-27
        • 2011-03-09
        • 2016-01-10
        • 1970-01-01
        • 2018-02-13
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多