Sunil Rk
Sunil Rk

Reputation: 1029

How to exclude some of the folders while creating zip file through maven

<assembly xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0"
     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembl/1.1.0 http://maven.apache.org/xsd/assembly-1.1.0.xsd">
    <id>bin</id>
    <baseDirectory>/</baseDirectory>
    <formats>
      <format>zip</format>
    </formats>
    <fileSets>
      <fileSet>
         <directory>src/main</directory>
         <outputDirectory>/</outputDirectory>
         <excludes>
            <exclude>src/main/dml</exclude>
         </excludes>
      </fileSet>
    </fileSets>
    </assembly>

This is my assemble.xml. src/main contains several folders. I want to exclude some folders, like src/main/dml, but it is not being excluded.

Upvotes: 20

Views: 24147

Answers (2)

Devendra  Singraul
Devendra Singraul

Reputation: 951

<fileSets>
      <fileSet>
             <!--\DemoService\target\classes-->
        <directory>${project.build.directory}/classes</directory>
        <outputDirectory>/</outputDirectory>
        <includes>
            <include>**/*</include>
        </includes>
      <!--to delete database directory-->
        <excludes>
            <exclude>database/**</exclude>
        </excludes>
    </fileSet>

Upvotes: 0

Miquel
Miquel

Reputation: 15675

Use this excludes to match the dml folder and its contents. Be sure to use a path relative to <directory>src/main</directory>

  <excludes>
            <exclude>dml/**</exclude>
  </excludes>

Upvotes: 37

Related Questions