Jis Jose
Jis Jose

Reputation: 644

Exclude folder from .war file

I am new in maven. My maven for war building is as follows

<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-war-plugin</artifactId>
    <version>2.4</version>
    <configuration>
        <failOnMissingWebXml>false</failOnMissingWebXml>
        <webXml>src/main/webapp/WEB-INF/web.xml</webXml>
        <packagingIncludes>resources/src/**</packagingIncludes>
    </configuration>
</plugin>

My application is a spark-java web application. I am also using angular2. Typescript and related library files are in src/main/resources/src/ folder. I am using gulp to compile the typescrpt files and the generated files go to src/main/resources/public/ folder. I want to exclude all the files and sub folders from src/main/resources/src/.

I have tried both packagingIncludes and warSourceExcludes but not working for me. Any help will be appreciated.

Upvotes: 1

Views: 1281

Answers (1)

Stefan
Stefan

Reputation: 12453

You can exclude the whole directory like this:

<build>
    <resources>
        <resource>
            <directory>src/main/resources/src/</directory>
            <excludes>
                <exclude>*</exclude>
            </excludes>
        </resource>
    </resources>
</build>

Or change the folder to: "src/main/typescript".

Upvotes: 0

Related Questions