rustic1206
rustic1206

Reputation: 11

Unable to exclude folders from war file using regex

I'm attempting to exclude all of the js/backbone directories with the exception of the libs directory from my war file. My pom file entry is as follows:

    <plugin>
        <artifactId>maven-war-plugin</artifactId>
        <version>2.3</version>
        <configuration>
            <packagingExcludes>
                %regex[js/backbone/[^l].*/]
            </packagingExcludes>
        </configuration>
    </plugin>

Unfortunately, no directories are being excluded. Any help will be greatly appreciated!!

Upvotes: 1

Views: 1964

Answers (1)

Casimir et Hippolyte
Casimir et Hippolyte

Reputation: 89557

Try to use a negative lookahead (?!..) to exclude the lib directory:

<plugin>
    <artifactId>maven-war-plugin</artifactId>
    <version>2.3</version>
    <configuration>
        <packagingExcludes>
            %regex[js/backbone/(?!libs/).*]
        </packagingExcludes>
    </configuration>
</plugin>

(?!libs/) means not followed by libs/

Upvotes: 2

Related Questions