如何使用模块将库添加到Wildfly Application Server?

时间:2023-01-18 11:19:28

I want to load the Application server Libraries in Java Build Path in Eclipse,

我想在Eclipse中的Java Build Path中加载Application Server Libraries,

I have 5 applications in Eclipse which shares common libraries, I can't put all the libraries in each project lib folder, so i want to add the libraries in Wildfly Application server using modules.

我在Eclipse中有5个共享公共库的应用程序,我不能将所有库放在每个项目的lib文件夹中,所以我想使用模块在Wildfly应用程序服务器中添加库。

This is my module.xml file add added the lib at WILDFLY_HOME/modules/system/layers/base/com/mysql/main/mysql-connector-java-5.1.23-bin.jar

这是我的module.xml文件添加在WILDFLY_HOME / modules / system / layers / base / com / mysql / main / mysql-connector-java-5.1.23-bin.jar中添加了lib

<?xml version="1.0" encoding="UTF-8"?>
<module xmlns="urn:jboss:module:1.1" name="com.mysql">
    <resources>
        <resource-root path="mysql-connector-java-5.1.23-bin.jar" />
    </resources>
    <dependencies>
        <module name="javax.api" />
        <module name="javax.transaction.api" />
    </dependencies>
</module>

After Restarting the server, this module is not loading in Eclipse Build path.
Can any one knows what wrong with this modules ?
In Wildfly I have some predefined modules, those are loading in build path successfully, but user-defined modules are not loading ?
Why ?

重新启动服务器后,此模块未在Eclipse Build路径中加载。任何人都知道这个模块有什么问题吗?在Wildfly中我有一些预定义的模块,那些是在构建路径中成功加载,但用户定义的模块没有加载?为什么?

1 个解决方案

#1


Solution found:

Follow below steps :

请遵循以下步骤:

Go To Eclipse > preferences > Server > Runtime Environments > Default Classpath Entries

转到Eclipse>首选项>服务器>运行时环境>默认类路径条目

Select "Wildfly 8.x Runtime" and add a module

选择“Wildfly 8.x Runtime”并添加一个模块

and click on apply, now rebuild your application and check,

然后单击“应用”,现在重建您的应用程序并检查,

the library will be added in buildpath by module name.

库将按模块名称添加到构建路径中。

#1


Solution found:

Follow below steps :

请遵循以下步骤:

Go To Eclipse > preferences > Server > Runtime Environments > Default Classpath Entries

转到Eclipse>首选项>服务器>运行时环境>默认类路径条目

Select "Wildfly 8.x Runtime" and add a module

选择“Wildfly 8.x Runtime”并添加一个模块

and click on apply, now rebuild your application and check,

然后单击“应用”,现在重建您的应用程序并检查,

the library will be added in buildpath by module name.

库将按模块名称添加到构建路径中。