代码之家  ›  专栏  ›  技术社区  ›  Anand B

使用maven创建公共输出zip文件

  •  2
  • Anand B  · 技术社区  · 13 年前

    我有3个模块链接到一个类似的父项目。

    root (pom.xml)
       +--- mod1 (pom.xml)
       +--- mod2 (pom.xml)
       +--- mod3 (pom.xml)
    

    我在mod1的config文件夹中有一些配置文件。我在mod2的config文件夹中有其他配置文件。我想把所有这些配置文件放在输出zip文件的一个公共文件夹中。

    这可能吗

    1 回复  |  直到 13 年前
        1
  •  3
  •   Andrew Logvinov    13 年前

    是的,这是可能的。你必须添加 maven-assembly-plugin 执行到构建过程中的最后一个模块(我假设在您的情况下是mod3),并添加程序集描述符,有点像这样:

    <assembly>
      <formats>
        <format>zip</format>
      </formats>
      <fileSets>
        <fileSet>
            <directory>../mod1/config</directory>
            <outputDirectory>config</outputDirectory>
        </fileSet>
        <fileSet>
            <directory>../mod2/config</directory>
            <outputDirectory>config</outputDirectory>
        </fileSet>
      </fileSets>
    </assembly>
    
    推荐文章