ZerekSees
ZerekSees

Reputation: 101

Maven build - Excluding directory

I have below pom.xml for the project. I want to exclude one folder from my build-jar,but want it in the source code. Whenever i am using tag the compiler is complaining :- Unrecognised tag: 'excludes'" . I want src/main/resources/conf/** not being part of the build.

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <groupId>com.abcd.msg.rega</groupId>
    <artifactId>tp</artifactId>
    <version>1.2.8-SNAPSHOT</version>
    <name>GenerateFixml</name>
    <scm>
        ...
    </scm>
    <distributionManagement>
        ...
    </distributionManagement>
    <properties>
    ...
    </properties>
    <build>
        <outputDirectory>target/classes</outputDirectory>
        <testOutputDirectory>target/test-classes</testOutputDirectory>
        <testSourceDirectory>src/test/java/</testSourceDirectory>
        <resources>
            <resource>
                <directory>src/main/resources</directory>
            </resource>
            <excludes>
            <exclude>src/main/resources/conf/**</exclude>
            </excludes>
            <resource>
                <directory>src/main/clj</directory>
            </resource>
        </resources>
        <testResources>
            ...
        </testResources>
        <plugins>
            ...
        </plugins>
    </build>
    <dependencies>
        ...
    </dependencies>
</project>

Upvotes: 0

Views: 689

Answers (1)

J Fabian Meier
J Fabian Meier

Reputation: 35883

You need to close the resource after the excludes, i.e. put </resource> behind </excludes>.

See also

https://maven.apache.org/plugins/maven-resources-plugin/examples/include-exclude.html

Upvotes: 1

Related Questions