Maven 战争覆盖和覆盖依赖

发布于 2024-10-09 05:32:14 字数 1729 浏览 0 评论 0原文

我正在使用战争覆盖来构建自定义网站。问题是原来的战争有一个旧的依赖关系,我想在构建战争时替换它。我排除了旧罐子并包含了新罐子,但当我打包时旧罐子仍然在那里。这是我的 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>

谢谢。

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.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

时常饿 2024-10-16 05:32:14

您需要在“maven-war-plugin”的插件配置部分中排除库。 此页面上有示例。

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

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文