问题描述
对我来说实际上几乎是不可能的,但是对于将JBoss提供的依赖项导入到Maven管理的Java EE应用程序中进行部署,似乎没有网上直接答案.
It's actually pretty unlikely for me, but it seems that there is no direct answer over the net about importing JBoss-provided dependencies into Maven-managed Java EE application to be deployed within it.
AFAIK与该问题有两方面的关联,即用于外部(从JVM而言)JBoss客户端的jboss-as-client
工件和具有巨大的<dependencyManagement>
块定义JBoss使用的库版本的jboss-as-component-matrix
工件.后一个工件非常有用,因为我可以使用Maven的导入范围来正确设置所有版本.缺少的(AFAIK)我类似于jboss-as-client
,但适用于已部署的Java EE应用程序.我可以依靠provided
范围进行操作,并将所有内容包含在类路径中,包括与平台相关的API(例如EJB或JMS)和特定于AS的内容(例如EJB-ext或jboss-messaging
)以及可能的其他内容lib
,lib/endorsed
和(主要)common/lib
目录中的内容.我知道,更好的做法(与宗教兼容)应该是在模块中使用依赖项来明确,但是我问的方式对我来说更为实用(对不起),至少对于真正使用Java EE的应用程序而言许多标准API.
AFAIK there are 2 things somehow related to the problem, that is jboss-as-client
artifact for external (in sense of JVM) JBoss clients and jboss-as-component-matrix
artifact with huge <dependencyManagement>
block defining version of the libraries that JBoss uses. The latter artifact is pretty useful since I can use Maven's import scope to have all version properly set up. The one that is missing (AFAIK) i something like jboss-as-client
but for deployed Java EE application. Something, that I can depend on with provided
scope and have all stuff in the classpath, including platform-related APIs (like EJB or JMS) and AS-specific stuff (like EJB-ext or jboss-messaging
) and possibly some other stuff from lib
, lib/endorsed
and (mainly) common/lib
directories. I know that probably a better practice (and religion-compatible) would be to be explicit with dependencies used in modules but the way I'm asking about is much more pragmatic for me (sorry), at least for Java EE applications that really use many standard APIs.
我真的很好奇您应对这种挑战的方式.我正在使用AS的5.1.0.GA版本.
I'm really curious about your way of dealing with such challange. I'm using 5.1.0.GA version of the AS.
推荐答案
您必须提供自己的(基础结构)maven项目,该项目仅打包所有提到的依赖项,并且您的所有JBoss项目都依赖于范围为provided
的该基础结构项目.
You have to provide your own (infrastructure) maven project which just packages all the mentioned dependencies and all your JBoss projects depend on this infrastructure project with scope provided
.
但是您不应该只针对规范jar而不是具体的实现进行编译吗?
喜欢
But shouldn't you compile just against the specification jars instead of the concrete implementation?
Like
<dependency>
<groupId>org.jboss.spec</groupId>
<artifactId>jboss-javaee-6.0</artifactId>
<version>1.0.0.Final</version>
<type>pom</type>
<scope>provided</scope>
</dependency>
跳转到 http://arquillian.org/guides/上首次出现的"Java EE 6 API" Getting_started/.
这篇关于由Maven管理的Java EE应用程序中的JBoss提供的库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!