Maven:javaee-api 与 jboss-javaee-6.0 [英] Maven: javaee-api vs jboss-javaee-6.0

查看:35
本文介绍了Maven:javaee-api 与 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 瘫痪,我.e.方法体丢失.测试时会出现这种情况.我曾经遇到过这个陷阱,并不太满意.

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.

您可以仔细查看 Adam Biens 博客

如果您确实需要,您还可以为不同的部署环境制作配置文件.然而,基本上我同意,遗憾的是这不是一个非常愉快的情况.

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.


顺便说一句,因为现在这可能很有趣.对于 Java EE 7 的 javaee-(web-)api,此问题已消失(来源)


By the way, since now this might be interessting. This issue is gone for the javaee-(web-)api for Java EE 7 (source)

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

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