Exclude file directory using the MAVEN build plugin

I would be pleased if you could help me sort this out.

When I create my project for .zip using the maven <assembly> plugin.

<assembly xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2"
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2 http://maven.apache.org/xsd/assembly-1.1.2.xsd">

<id>dev</id>
<formats>
    <format>zip</format>
</formats>

<fileSets>

    <fileSet>
        <directory>${basedir}</directory>
        <includes>
            <include>/environments/dev/**/*.sh</include>
            <include>/environments/dev/**/*.jil</include>
            <include>/environments/dev/**/*.properties</include>
            <include>/environments/dev/**/log4j2.xml</include>  
        </includes>  
    </fileSet>

</fileSets>

<dependencySets>
    <dependencySet>
        <outputDirectory>/lib</outputDirectory>
        <useProjectArtifact>true</useProjectArtifact>
        <scope>runtime</scope>
    </dependencySet>
</dependencySets>

I get the following file structure:

build.zip----> environments__
                            |_DEV_
                                  |_bin
                                  |_properties
                                  |_....

My goal:

To get the following file structure after building maven:

 build.zip----> 
                                  |_bin
                                  |_properties
                                  |_....

Without the environment and the DEV folder.

I read in the maven documentation ( http://maven.apache.org/plugins/maven-assembly-plugin/advanced-descriptor-topics.html ) that we can exclude some file directories. Thus:

<assembly> 
    ....

    <fileSets> 
        <fileSet>
            <directory>${basedir}</directory>
            <includes>
              ....
            </includes>
            <excludes>
                <exclude>/environments/dev</exclude>
            </excludes>
        </fileSet> 
    </fileSets>

    <dependencySets>
        <dependencySet>
            <outputDirectory>/lib</outputDirectory>
            <useProjectArtifact>true</useProjectArtifact>
            <scope>runtime</scope>
        </dependencySet>
    </dependencySets>
</assembly>

But that does not help. I still have the previous file structure.

+4
source share
1

/environment/dev

<fileSet>
    <directory>${basedir}/environments/dev</directory>
    <outputDirectory>/</outputDirectory>
    <filtered>false</filtered>
</fileSet>
+5

All Articles