use wildcard to copy folders using maven-assembly-plugin

16,628

Solution 1

finally I was successful to do it:

<fileSet>
        <directory>target</directory>
        <includes>
            <include>lib*/*</include>
        </includes>
        <outputDirectory>/</outputDirectory>
    </fileSet>

Solution 2

You can do

<fileSet>
    <directory>target/</directory>
    <outputDirectory>lib-oracle</outputDirectory>
</fileSet>`

Even this will allow you to get all the data from inside target folder.

Solution 3

You can use:

<fileSet>
    <directory>target</directory>
    <includes>
        <include>lib-oracle/**</include>
        <outputDirectory>/</outputDirectory>
    </includes>
</fileSet>

'**' indicates all the files in the current folder and all the files in the subfolders of the current folder.

Share:
16,628
Saeed
Author by

Saeed

9 years experienced developer. I am interested in Java, J2EE, Maven, Eclipse, Spring. And also blockchain and smart contract. Let's do it ;)

Updated on June 27, 2022

Comments

  • Saeed
    Saeed almost 2 years

    I am using maven-assembly-plugin to collect some files and folders in a .tar.gz file. In my target directory, I have some folders with these names (for example):

    lib-oracle lib-mysql lib-sqlserver . .

    and each folder contains some jar files.

    I want to copy these folders (and also contents of them) into a final .tar.gz file. I know I can copy them separately like this:

    <fileSet>
        <directory>target/lib-oracle</directory>
        <outputDirectory>lib-oracle</outputDirectory>
    </fileSet>
    

    but I'm interested to know if there is any way to copy them all together?
    maybe something like this:

    <fileSet>
        <directory>target/lib*</directory>
    </fileSet>