本文介绍了Maven:javaee-api vs jboss-javaee-6.0的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想要一个使用maven构建的Java JEE6项目,而我想要的是标准

I want a Java JEE6 project built with maven, and I want it standard

所以,我将其放在我的pom.xml中:

So, I put this in my pom.xml:

<dependency>
    <groupId>javax</groupId>
    <artifactId>javaee-api</artifactId>
    <version>6.0</version>
    <scope>provided</scope>
</dependency>

像这样的项目,它应该运行在每个JEE6容器兼容(jboss,geronimo,glashfish等等)

A project like this, it is supposed to run in every JEE6 container compatible (jboss, geronimo, glashfish, etc.)

然后,为什么这个jboss依赖存在?

Then, why this jboss dependency exists?

<dependency>
    <groupId>org.jboss.spec</groupId>
    <artifactId>jboss-javaee-6.0</artifactId>
    <version>3.0.2.Final</version>
    <scope>provided</scope>
 </dependency>

如果我使用它,我绑定到jboss,所以我只能使用这个服务器与这个应用程序?

If I use it, am I tied to jboss so I can only use this server with this application?

是不是总是使用标准的javaee-api?

Is it not preferable to always use the standard javaee-api?

谢谢!

推荐答案

标准api是瘫痪的,即方法体缺少。测试时会出现这种情况。我曾经遇到过这个陷阱,并不是很满意。

The standard api is crippled, i. e. method bodies are missing. This turns out when testing. I have once run into this pitfall and was not very happy with it.

因此,建议使用另一个包作为参考。

Therefore it is advisiable to use another package as reference.

您可以仔细查看

如果您真的需要,还可以为不同的部署环境配置文件。然而,基本上我同意,这可悲的是不是一个非常愉快的情况。

You can also make profiles for different deployment environments if you really need. However, essentially I agree, this is sadly not a very pleasant circumstance.

有关测试的问题,您可以看一下。

For having issues with testing, you can have a look at this thread.

编辑:

顺便说一句,由于现在这可能是整合的。 JavaEE 7 ()

这篇关于Maven:javaee-api vs jboss-javaee-6.0的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-30 07:10