'Maven-assembly-plugin: add multiple files of multiple directories to one output directory

Anyone an idea of how to add multiple files of multiple directories to one output directory without sub-directories using the maven assembly plugin.

Imagine following structure:

prjdir
   |-dir1
      |-target
         |-file1
   |-dir2
      |-target
         |-file2
   ...
   |-dirN
      |-target
         |-fileN

I can use a fileSet to add the files ie.:

<fileSet>
  <directory>../prjdir</directory>
  <outputDirectory>myoutput</outputDirectory>
  <includes>
    <include>*/target/file*</include>
  </includes>
</fileSet>

Which then creates the myoutput directory like:

myoutput
   |-dir1
      |-target
         |-file1
   |-dir2
      |-target
         |-file2
   ...
   |-dirN
      |-target
         |-fileN

But what the hell I should do if I want only the files on myoutput without the directory structure of the source...

myoutput
   |-file1
   |-file2
   ...
   |-fileN

This is only an simplified example, which means I need to do it a generic way. Can't use <files><file> and also can't list every file explicitly, as they are generated dynamically without knowing the name beforehand ...

Thanks in advance for you support ...

Cheers m_n



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source