Maven-assembly-plugin: How do I change the output directory?

I want to create a zip file containing jar files and some resource files. But I have some problems to tell the build plugin to take files from the source folder and put it in the target folder without preserving the source folder structure.

More details: My files are placed in .. / target / lib and should be pinned to .. / app / lib. This is an excerpt from my xml file that should accomplish this task:

    <fileSet>
      <directory>${project.basedir}</directory>
      <outputDirectory>app/lib</outputDirectory>
      <includes>
        <include>target/lib/*.*</include>
      </includes>
    </fileSet>

      

But what happens: The files are placed in the .. / app / lib / target / lib / folder

How can I tell the maven-assembly-plugin to omit the source file structure and just grab the files?

+3


source to share


2 answers


I managed to fix this by setting the "directory" parameter to the original path and removing the source path information from the "include":



    <fileSet>
      <directory>${project.basedir}/target/lib/</directory>
      <outputDirectory>app/lib</outputDirectory>
      <includes>
        <include>*.*</include>
      </includes>
    </fileSet>

      

0


source


The directory must point to the folder where all paths (both files and directories) are to be copied. Therefore, you must do this:



<fileSet>
  <directory>${project.basedir}/target/lib</directory>
  <outputDirectory>app/lib</outputDirectory>
  <includes>
    <include>*.*</include>
  </includes>
</fileSet>

      

0


source







All Articles