java 在 WildFly 10 中添加 jar 作为部署
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/39122046/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
adding jars as deployment in WildFly 10
提问by MDaniyal
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
像在weblogic
服务器中那样将 jar 部署为库/部署?或者我们可以将 jars 放在服务器的任何文件夹中并将这些依赖项定义为provided
?
采纳答案by MDaniyal
What I got the way to deploy jar
s on WildFly 10
server rather than making part of the war file is define below:
我jar
在WildFly 10
服务器上部署s而不是制作War文件的一部分的方法定义如下:
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:
1) 把你所有的 jars 放进去wildfly\modules\system\layers\base\com\abcProject\main
并放置一个文件名module.xml
,内容如下:
<?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>
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.
哪里resources
是所有那些jars
存在于您的abcProject/main
文件夹,dependencies
都是那些jars
上你的jars
依赖和存在于wildfly\modules\system\layers\base
文件夹中。
2) Then in your project add a file named jboss-deployment-structure.xml
in WEB-INF
folder with the following conents:
2)然后在您的项目中添加一个jboss-deployment-structure.xml
在WEB-INF
文件夹中命名的文件,内容如下:
<?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) Now set scope
of all those dependencies
in your pom
files as provided
that you have placed jars
in abcProject/main
folder.
3)现在设置scope
所有这些dependencies
在你的pom
文件,provided
你已经放置jars
在abcProject/main
文件夹中。
That's all now run your project it will get all jar
s from server and will not include in war
file during compilation.
这就是现在运行您的项目的全部内容,它将jar
从服务器获取所有s,并且war
在编译期间不会包含在文件中。