简体   繁体   English

在WildFly 10中添加jar作为部署

[英]adding jars as deployment in WildFly 10

Is there a way, we can deploy jars as a library/deployment in WildFly 10 like we can do it in weblogic server?. 有没有办法,我们可以将jar作为库/部署部署在WildFly 10就像我们可以在weblogic服务器中一样? OR can we place the jars in any folder of server and define those dependencies as provided ? 或者我们可以将jar放在服务器的任何文件夹中并定义provided依赖项吗?

What I got the way to deploy jar s on WildFly 10 server rather than making part of the war file is define below: 我在WildFly 10服务器上部署jar而不是生成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)将所有罐子放在wildfly\\modules\\system\\layers\\base\\com\\abcProject\\main并放置一个名为module.xml的文件, 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)然后在您的项目中,在WEB-INF文件夹中添加一个名为jboss-deployment-structure.xml文件,其中包含以下内容:

<?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)现在设置你的pom文件中所有这些dependencies scopeprovided你已经将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 ,并且在编译期间不会包含在war文件中。

To add external jars as a "library" in Jboss/Wildfly, you can define it as a module in your installation, or add it to an existing module. 要将外部jar作为“库”添加到Jboss / Wildfly中,您可以将其定义为安装中的模块,或将其添加到现有模块中。

See this link for more details on how to add a module in Wildfly. 有关如何在Wildfly中添加模块的更多详细信息,请参阅此链接

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM