Maven 战争覆盖和覆盖依赖
我正在使用战争覆盖来构建自定义网站。问题是原来的战争有一个旧的依赖关系,我想在构建战争时替换它。我排除了旧罐子并包含了新罐子,但当我打包时旧罐子仍然在那里。这是我的 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您需要在“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.