Search code examples
maven-2maven-pluginmaven-assembly-plugin

Using <fileSets> with Maven assemblies


I am trying to add specific directories from Maven modules into my build. I believe that fileSets are the way to go back this.

I would appreciate a clear and concise way of using fileSets to obtain necessary directories from Maven modules that just simply contain a directory with some necessary resources.


Solution

  • If you want to include entire modules, use moduleSets, but if you want to pick and choose which files to add you can use fileSets in an assembly config file from the top level project like this:

      <fileSets>
         <fileSet>
            <directory>${basedir}/myModule/src/main/resources</directory>   
            <includes>
               <include>*.txt</include>
            </includes>
         </fileSet>
      </fileSets>