1

这是我的项目结构:

myapp-parent
  moduleMain
      src/main/java   ---> main class (it loads a spring context)
      src/main/config ---> main config files
  module1
      src/main/java   ---> specific code of the module
      src/main/config ---> specific config files of the module

我正在使用程序集和 appassembler maven 插件进行分发。这是程序集描述符:

<assembly>
<id>archive</id>
<formats>
    <format>zip</format>
    <format>tar.gz</format>
</formats>

    <fileSets>
   <fileSet>
        <directory>${project.build.directory}/generated-resources/appassembler/jsw/myProject/bin</directory>
        <outputDirectory>bin</outputDirectory>
        <includes>
            <include>**</include>
        </includes>
        <useDefaultExcludes>true</useDefaultExcludes>
        <fileMode>0755</fileMode>
        <directoryMode>0755</directoryMode>
    </fileSet>

    <fileSet>
        <directory>src/main/config</directory>
        <outputDirectory>conf</outputDirectory>
    </fileSet>

    <fileSet>
        <directory>${project.build.directory}/generated-resources/appassembler/jsw/myProject/conf</directory>
        <outputDirectory>conf</outputDirectory>
    </fileSet>

    <fileSet>
        <directory>${project.build.directory}/generated-resources/appassembler/jsw/myProject/lib</directory>
        <outputDirectory>lib</outputDirectory>
    </fileSet>
 </fileSets> 
</assembly>

因此,我得到了一个包含配置文件夹('conf')的分发包。问题是该目录中的配置文件来自 mainModule,我想从 module1 获取配置文件也将位于同一位置。

myProject.tar.gz
    bin
    lib
    logs
    conf --> Here we have config files from modeuleMain & module1

任何的想法???

4

2 回答 2

2

您可能需要检查<moduleSet/>程序集描述符中的配置,尤其是<sources/>小节:ModuleSet Source-Inclusion Example

注意:这只会让您自己获得解决方案的一部分!问题是程序集插件的 moduleSets 函数最初设计用于仅对当前项目的子模块(创建程序集的模块)进行操作。为了解决这个问题,我们在程序集插件的 2.2 版中或附近引入了一个新配置,称为<useAllReactorProjects/>. 将此标志设置为true,使当前构建中的所有模块都可用于程序集。

如果您在 moduleSet 中启用此功能,您应该能够包含来自 module1 的配置文件。

于 2012-12-19T19:07:46.940 回答
0

您是否探索过组装插件的多模块支持?

http://maven.apache.org/plugins/maven-assembly-plugin/examples/multimodule/index.html

于 2012-12-19T15:02:08.757 回答