在WildFly 10中添加jar作为部署 [英] adding jars as deployment in WildFly 10
问题描述
有没有办法,我们可以将jar作为库/部署部署在 WildFly 10
中,就像我们可以在 weblogic $ c中一样$ c>服务器?或者我们可以将jar放在服务器的任何文件夹中,并将这些依赖项定义为
提供
?
Is there a way, we can deploy jars as a library/deployment in WildFly 10
like we can do it in weblogic
server?. OR can we place the jars in any folder of server and define those dependencies as provided
?
推荐答案
我得到了在 WildFly 10
服务器上部署 jar
的方法,而不是参与其中war文件定义如下:
What I got the way to deploy jar
s on WildFly 10
server rather than making part of the war file is define below:
1)将所有罐子放入 wildfly\modules\system\layers\base \ com \abcProject \main
并放置一个名为 module.xml
的文件,其中包含以下内容:
1) Put all your jars in wildfly\modules\system\layers\base\com\abcProject\main
and place a file named module.xml
with the following content:
<?xml version="1.0" encoding="UTF-8"?>
<module xmlns="urn:jboss:module:1.3" name="com.abcProject">
<resources>
<resource-root path="aspectjrt-1.6.8.jar"/>
<resource-root path="aspectjweaver-1.6.8.jar"/>
<resource-root path="aopalliance-1.0.jar"/>
<resource-root path="guava-18.0.jar"/>
</resources>
<dependencies>
<module name="javaee.api"/>
<module name="org.apache.commons.logging"/>
<module name="org.jboss.vfs"/>
</dependencies>
其中资源
是 abcProject / main
文件夹中存在的所有 jars
和依赖
是 jars
所有 jars
依赖且存在的在 wildfly\modules\system\layers\base
文件夹中。
Where resources
are all those jars
present in your abcProject/main
folder and dependencies
are all those jars
on which your jars
are dependent and are present in wildfly\modules\system\layers\base
folders.
2)然后在你的项目中在 WEB-INF
文件夹中添加名为 jboss-deployment-structure.xml
的文件,其中包含以下内容:
2) Then in your project add a file named jboss-deployment-structure.xml
in WEB-INF
folder with the following conents:
<?xml version="1.0"?>
<jboss-deployment-structure xmlns="urn:jboss:deployment-structure:1.2" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<deployment>
<dependencies>
<module name="com.abcProject" >
<imports>
<include path="META-INF**"/>
<include path="org**"/>
</imports>
</module>
</dependencies>
</deployment>
3)现在设置范围
在您的 pom
文件中的所有依赖项
已提供
您已在 abcProject / main
文件夹中放置 jars
。
3) Now set scope
of all those dependencies
in your pom
files as provided
that you have placed jars
in abcProject/main
folder.
这就是现在运行你的项目它将从服务器获得所有 jar
s并且不包括在 war
文件。
That's all now run your project it will get all jar
s from server and will not include in war
file during compilation.
这篇关于在WildFly 10中添加jar作为部署的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!