如何让maven在JDK中使用不同的JAXB库 [英] How to get maven to use a different JAXB library to one in JDK

查看:316
本文介绍了如何让maven在JDK中使用不同的JAXB库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用java 1.6.0_14,其中包含注释 javax.xml.bind.annotation.XmlElement 的实现。但是JDK中的那个仅适用于Method和Field。

I'm using java 1.6.0_14 which includes an implementation of the annotation javax.xml.bind.annotation.XmlElement. However the one in the JDK only applies to Method and Field.

我发现jaxb-api.jar版本2.2.3也允许参数,所以我想使用这个版本。

I've found jaxb-api.jar version 2.2.3 permits this on Parameter too, so I want to use this version.

问题是,我无法弄清楚如何让maven使用这个优先于JDK中的那个,这样当我编写代码时它就不会不要抱怨注释在无效位置使用。

Problem is, I can't figure out how to get maven to use this one in preference to the one in the JDK so that when I am writing my code it doesn't complain that the annotation is being used in an invalid location.

有什么建议吗?

推荐答案

在您的POM中包含显式依赖项:

Include an explicit dependency in your POM:

<dependency>
    <groupId>javax.xml.bind</groupId>
    <artifactId>jaxb-api</artifactId>
    <version>2.2.3</version>
</dependency>

这篇关于如何让maven在JDK中使用不同的JAXB库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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