robinmag
robinmag

Reputation: 18100

maven war overlays and override dependency

I'm using war overlay to build custom site. The problem is the original war has an old dependency and i want to replace it when building the war. I excluded the old jar and included the new one, but the old one was still there when i packaged it. Here is my pom:

<?xml version="1.0"?>
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">

    <modelVersion>4.0.0</modelVersion>
    <groupId>com.foo</groupId>
    <artifactId>test</artifactId>
    <version>1</version>
    <packaging>war</packaging>

    <properties>
        <cas.version>3.4.5</cas.version>
    </properties>

    <dependencies>
        <dependency>
            <groupId>org.jasig.cas</groupId>
            <artifactId>cas-server-webapp</artifactId>
            <version>${cas.version}</version>
            <type>war</type>
            <scope>runtime</scope>
            <exclusions>
                <exclusion>
                    <groupId>org.hibernate.javax.persistence</groupId>
                    <artifactId>hibernate-jpa-2.0-api </artifactId>
                </exclusion>
            </exclusions>
        </dependency>

        <dependency>
            <groupId>org.hibernate.javax.persistence</groupId>
            <artifactId>hibernate-jpa-2.0-api </artifactId>
            <version>1.0.0.Final</version>
        </dependency>
    </dependencies>

    <build>
        <finalName>xp.test</finalName>
    </build>
</project>

Thank you.

Upvotes: 2

Views: 3559

Answers (1)

Stephen C
Stephen C

Reputation: 718698

You need to exclude the libraries in the plugin configuration section for the "maven-war-plugin". There are examples on this page.

Upvotes: 5

Related Questions