arinte
arinte

Reputation: 3728

Maven not honoring excludes

We have this in our pom

        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-jar-plugin</artifactId>
            <version>2.3.2</version>
            <executions>
                <execution>
                    <id>assembly</id>
                    <phase>package</phase>
                    <goals>
                        <goal>jar</goal>
                    </goals>
                    <configuration>
                        <excludes>
                            <exclude>app/**</exclude>
                            <exclude>WEB-INF/**</exclude>
                        </excludes>
                    </configuration>
                </execution>
                <execution>
                    <id>assembly-web</id>
                    <phase>package</phase>
                    <goals>
                        <goal>jar</goal>
                    </goals>
                    <configuration>
                        <classifier>web</classifier>
                        <includes>
                            <include>app/**</include>
                            <include>WEB-INF/**</include>
                        </includes>
                    </configuration>
                </execution>
            </executions>
        </plugin>

When I open the xxx-web.jar it looks as expected, but when I look at xxx.jar it includes everything/didn't exclude anything. If I were to add a classified to the 1st plugin (the one with the excludes) then it works properly???

I want this to work in such a way that the xxx.jar has all the class and property files and the xxx-web only has the jsp/css files.

Upvotes: 0

Views: 142

Answers (3)

Bobby Hargett
Bobby Hargett

Reputation: 481

Take a look at 7.1.6 in this maven document. Basically you need to bind to the default goal of "default-jar".

HTH

Upvotes: 1

Jonathan S. Fisher
Jonathan S. Fisher

Reputation: 8817

You're telling maven to execute twice with each <execution> command. Try putting the includes and excludes under the same execution.

Upvotes: 0

khmarbaise
khmarbaise

Reputation: 97389

Take a look at this: Maven and working with legacy app there you will find the complete solution for your problem.

Upvotes: 0

Related Questions