简体   繁体   English

EJB 3.1的Maven依赖关系[jboss-ejb-api_3.1_spec]

[英]Maven Dependency for EJB 3.1 [jboss-ejb-api_3.1_spec]

I followed some tutorials on EJB 3.1 and those were using the following dependency for EJB-API. 我遵循了一些有关EJB 3.1的教程,这些教程对EJB-API使用了以下依赖关系。

    <dependency>
        <groupId>org.jboss.spec.javax.ejb</groupId>
        <artifactId>jboss-ejb-api_3.1_spec</artifactId>
        <version>1.0.2.Final</version>
    </dependency>

My problem is, this is only for jboss or can I used this in any other application servers. 我的问题是,这仅适用于jboss或可以在其他任何应用程序服务器中使用。 If not why there are dependency like these which are not independent from the application server it gets deployed. 如果不是这样,为什么会有这样的依赖关系不独立于应用程序服务器而被部署。 And also I found this reference for ejb 3.1 api. 我也找到了针对ejb 3.1 api的参考 Therefore please elaborate what are these and why those are there. 因此,请详细说明这些内容及其原因。

Here you go. 干得好。 This is from EJB specs . 这来自EJB规范

<dependency>
    <groupId>javax.ejb</groupId>
    <artifactId>javax.ejb-api</artifactId>
    <version>3.2</version>
</dependency>

Hope this helps. 希望这可以帮助。

You can use it on any server you like. 您可以在任何喜欢的服务器上使用它。 Just remember to put add the <scope>provided</scope> tag to the dependency like this: 只需记住将<scope>provided</scope>标记添加到依赖项中,如下所示:

<dependency>
        <groupId>org.jboss.spec.javax.ejb</groupId>
        <artifactId>jboss-ejb-api_3.1_spec</artifactId>
        <version>1.0.2.Final</version>
        <scope>provided</scope>
</dependency>

The provided scope means that this dependency is only used to compile your code and not included in the resulting EAR/WAR/JAR. provided作用域意味着此依赖项仅用于编译您的代码,而不包含在生成的EAR / WAR / JAR中。 In the runtime this dependency is provided by your application server (JBoss, Websphere, whatever). 在运行时中,此依赖关系由您的应用程序服务器(JBoss,Websphere等)提供。 If you omit the scope specification section very bad things may happen. 如果省略范围规范部分,则可能会发生非常糟糕的事情。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM