如何在Maven中使用BOM表文件? [英] How to use BOM file with Maven?

查看:847
本文介绍了如何在Maven中使用BOM表文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经在互联网上进行了大量研究,但没有找到任何简单的解释来说明如何使用Maven处理BOM文件.

I have done considerable research in internet and I haven't found any easy explanation what to do with BOM files with Maven.

问题是我使用JBoss 7.1.1,并且想在pom.xml中包含所有JBoss客户端jar. JBoss有一本手册,说我应该使用BOM表文件,但是我不知道如何在我的pom.xml中使用它.

The problem is that I use JBoss 7.1.1 and I want to include all JBoss client jars in pom.xml. JBoss has a manual that says that I should use BOM files, but I don't know how to use it in my pom.xml.

请帮助.

推荐答案

bom是所谓的材料清单-它捆绑了多个依赖项以确保版本可以一起使用. JBoss在其许多项目中都有宝物,包括 Arquillian

A bom is a so called bill of materials - it bundles several dependencies to assure that the versions will work together. JBoss has boms for many of it's projects, including Arquillian and the JBoss AS itself.

the Maven文档-隐藏在下面.

一个实际的例子:

您将bom这样包含在pom中:

You include the bom into your pom like this:

<dependencyManagement>
    <dependencies>
        <dependency>
            <groupId>org.jboss.bom</groupId>
            <artifactId>jboss-javaee-6.0-with-tools</artifactId>
            <version>${javaee6.with.tools.version}</version>
            <type>pom</type>
            <scope>import</scope>
        </dependency>
    </dependencies>
</dependencyManagement> 

然后,如果像这样在bom中定义的依赖项,则不必指定依赖项的version属性:

Then you do not have to specify the version attribute of a dependency, if it is defined in the bom like this:

<dependency>
    <groupId>javax.enterprise</groupId>
    <artifactId>cdi-api</artifactId>
    <scope>provided</scope>
</dependency>

这篇关于如何在Maven中使用BOM表文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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