wildfly ejb 独立客户端的 Maven 依赖项

Maven dependency entry for wildfly ejb standalone client

我正在为部署到 jboss wildfly 9.0.1.Final 的 ejb 应用程序编写独立客户端。我查看的文档表明在 wildfly 目录中有一个自述文件 (readme-ejb-jms.txt)。该文件包含以下对 Maven 依赖项的建议:

<dependencies>
    <dependency>
        <groupId>org.jboss.as</groupId>
        <artifactId>jboss-as-ejb-client-bom</artifactId>
        <type>pom</type>
    </dependency>
    <dependency>
        <groupId>org.jboss.as</groupId>
        <artifactId>jboss-as-jms-client-bom</artifactId>
        <type>pom</type>
    </dependency>
</dependencies>

如果我使用它,我会收到一条错误消息,提示需要版本,因此我将依赖项修改为如下所示:

    <dependency>
        <groupId>org.jboss.as</groupId>
        <artifactId>jboss-as-ejb-client-bom</artifactId>
        <version>9.0.1.Final</version>
        <type>pom</type>
    </dependency>
    <dependency>
        <groupId>org.jboss.as</groupId>
        <artifactId>jboss-as-jms-client-bom</artifactId>
        <version>9.0.1.Final</version>
        <type>pom</type>
    </dependency>

当我 运行 mvn clean install 使用上面的方法时,我得到这个错误:

The following artifacts could not be resolved: 
org.jboss.as:jboss-as-ejb-client-bom:pom:9.0.1.Final, 
org.jboss.as:jboss-as-jms-client-bom:pom:9.0.1.Final: 
Failure to find org.jboss.as:jboss-as-ejb-client-bom:pom:9.0.1.Final 

mvn clean install 的完整输出如下所示:

C:\_WORKSPACE\workspace\_myapp\myappjbosswildflyclient>mvn clean install
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building myappjbosswildflyclient 4.3.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[WARNING] The POM for org.jboss.as:jboss-as-ejb-client-bom:pom:9.0.1.Final is missing, no dependency information available
[WARNING] The POM for org.jboss.as:jboss-as-jms-client-bom:pom:9.0.1.Final is missing, no dependency information available
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 0.957s
[INFO] Finished at: Tue Aug 04 17:17:04 EDT 2015
[INFO] Final Memory: 5M/118M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal on project myappjbosswildflyclient: Could not resolve dependencies for project mycompany-myapp:myappjbosswildflyclient:jar:4.3.0-SNAPSHOT: The following artifacts could not be resolved: org.jboss.as:jboss-as-ejb-client-bom:pom:9.0.1.Final, org.jboss.as:jboss-as-jms-client-bom:pom:9.0.1.Final: Failure to find org.jboss.as:jboss-as-ejb-client-bom:pom:9.0.1.Final in http://downl
oad.java.net/maven/2 was cached in the local repository, resolution will not be reattempted until the update interval of java.net2 has elapsed or updates are forced -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/DependencyResolutionException
C:\_WORKSPACE\workspace\_myapp\myappjbosswildflyclient>

我应该为这些依赖项使用什么?

您似乎没有访问 Maven 存储库的权限,或者在检索依赖项 jar 时可能已断开连接。您可以手动删除本地存储库并重试构建

我找到了这个 post 并遵循了它提供的建议:

https://developer.jboss.org/thread/237382

我的依赖项如下所示:

    <dependency>
        <groupId>org.wildfly</groupId>
        <artifactId>wildfly-ejb-client-bom</artifactId>
        <type>pom</type>
        <version>8.0.0.Final</version>
        <scope>import</scope>
    </dependency>
    <dependency>
        <groupId>org.wildfly</groupId>
        <artifactId>wildfly-jms-client-bom</artifactId>
        <type>pom</type>
        <version>8.0.0.Final</version>
        <scope>import</scope>
    </dependency>

我现在可以构建项目并为 ejb 查找创建初始上下文。

我尝试使用 9.0.1.Final 和 9.0.0.Final 作为版本,但没有成功。

我对版本不匹配以及随发行版提供的 README-EJB-JMS.txt 文件中记录的依赖项不起作用这一事实感到非常不安。

这对我来说很好用:

<dependency>
    <groupId>org.wildfly</groupId>
    <artifactId>wildfly-ejb-client-bom</artifactId>
    <type>pom</type>
    <version>9.0.1.Final</version>
</dependency>
<dependency>
    <groupId>org.wildfly</groupId>
    <artifactId>wildfly-jms-client-bom</artifactId>
    <type>pom</type>
    <version>9.0.1.Final</version>
</dependency>

您的依赖项必须是 POM 类型。

<type>pom</type>