我正在为部署到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>
我应该为这些依赖项使用什么?
答案 0 :(得分:4)
这对我来说很好用:
socket
答案 1 :(得分:1)
看起来您无法访问maven存储库,或者在检索依赖关系jar时可能已断开连接。您可以手动删除本地存储库并重试构建
答案 2 :(得分:1)
您的依赖项必须是POM类型。
<type>pom</type>
答案 3 :(得分:0)
我找到了这篇文章并遵循了它提供的建议:
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文件中记录的依赖项不起作用这一事实感到非常不舒服。