覆盖父pom依赖 [英] Override parent pom dependency

查看:3044
本文介绍了覆盖父pom依赖的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

项目结构如下:

我使用maven和wildfly制作了一个简单的EAR项目,但是我有一些过时依赖的问题。 b

Project structure is like:

Project
  --EarProject
  --BaseProject
  --WarProject
  --EjbProject

在父项目的pom中有依赖关系:

In parent Project's pom there is dependency:

<dependency>
    <groupId>org.wildfly.bom</groupId>
    <artifactId>jboss-javaee-7.0-with-tools</artifactId>
    <version>${version.jboss.bom}</version>
    <type>pom</type>
    <scope>import</scope>
</dependency>

在BaseProject的pom中我使用Selenium:

And in BaseProject's pom I use Selenium:

<dependency>
    <groupId>org.seleniumhq.selenium</groupId>
    <artifactId>selenium-java</artifactId>
</dependency>
<dependency>
    <groupId>org.seleniumhq.selenium</groupId>
    <artifactId>selenium-remote-driver</artifactId>
</dependency>

问题是在BaseProject Maven库中,我看到旧版本的Selenium(即selenium-firefox-驱动程序2.40.0而不是较新的2.44.0),并且由于2.40.0中的错误,我的应用程序不能正常工作。
我试图添加:

The problem is that in BaseProject Maven libraries I see older versions of Selenium (ie. selenium-firefox-driver 2.40.0 instead of newer 2.44.0) and because of bugs in 2.40.0 my app does not work corectly. I tried to add:

<version>2.44.0</version>

,但是我收到了一些警告,如

in BaseProject's pom, but I got warning like


覆盖托管版本2.40.0 for selenium-remote-driver

Overriding managed version 2.40.0 for selenium-remote-driver

,它不起作用

如何从父级的pom或从jboss-javaee-7.0与工具依赖关系排除selenium的依赖关系版本?

How can I override version of dependency from parent's pom or exclude selenium from jboss-javaee-7.0-with-tools dependency?

推荐答案


如何从父级的pom覆盖依赖关系的版本

How can I override version of dependency from parent's pom

覆盖托管版本2.40.0 for selenium-remote-driver警告只是一个m2e警告,而不是一个Maven警告。使用您的代码,您正确地覆盖了父进程的pom的依赖关系版本。 有关此警告的信息,请参阅Eclipse网站上关于m2e的此错误。您可以通过查看依赖关系树(在Eclipse中或使用 mvn依赖:树 命令)

The "Overriding managed version 2.40.0 for selenium-remote-driver" warning is a just a m2e warning not a Maven warning. With your code, you are correctly overriding the version of the dependency of the parent's pom. See this bug at Eclipse site for m2e about this warning. You can assert that by looking at the dependency tree (in Eclipse or with the mvn dependency:tree command)


或排除硒jboss-javaee-7.0-with-tools依赖关系?

or exclude selenium from jboss-javaee-7.0-with-tools dependency?

你可以使用 排除 标签。它是一个标签,您可以在其中指定要从Maven解析的传递依赖关系中排除的每个groupId和artifactId。

You can do that with the exclusions tag. It is a tag where you specify each groupId and artifactId that you want to exclude from the transitive dependencies resolved by Maven.

这篇关于覆盖父pom依赖的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆