我遇到了一个问题,如何正确地将我的企业(EAR)应用程序与简单的WAR和EJB3模块打包为JBoss7应用服务器。问题在于,EJB模块正在使用XML-RPC库(来自Apache),但在部署EAR时仍然会出现“NoDefClassFound”(来自此xmlrpc库的类)。
问题在于,maven-ejb-plugin不会在最终的EJB jar中打包依赖项,但是maven-ear-plugin确实会将其打包到EAR目录的根目录中。
当EAR被部署时,在内部EJB模块上调用INSTALL,但它找不到xmlrpc库类(它没有与EJB jar一起打包,而是与EAR一起打包,并且在清单中没有任何条目)。
EJB pom.xml
有没有什么办法可以用maven干净地解决这个问题?
问题在于,maven-ejb-plugin不会在最终的EJB jar中打包依赖项,但是maven-ear-plugin确实会将其打包到EAR目录的根目录中。
当EAR被部署时,在内部EJB模块上调用INSTALL,但它找不到xmlrpc库类(它没有与EJB jar一起打包,而是与EAR一起打包,并且在清单中没有任何条目)。
EJB pom.xml
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>cz.ctu.fee.voxport.app_logic</groupId>
<artifactId>core</artifactId>
<version>1.0</version>
<packaging>ejb</packaging>
<dependencies>
<dependency>
<groupId>javax</groupId>
<artifactId>javaee-api</artifactId>
<version>6.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.apache.xmlrpc</groupId>
<artifactId>xmlrpc-common</artifactId>
<version>3.1.3</version>
</dependency>
<dependency>
<groupId>org.apache.xmlrpc</groupId>
<artifactId>xmlrpc-client</artifactId>
<version>3.1.3</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-ejb-plugin</artifactId>
<version>2.3</version>
<configuration>
<ejbVersion>3.1</ejbVersion>
<archive>
<manifest>
<addClasspath>true</addClasspath>
</manifest>
</archive>
</configuration>
</plugin>
</plugins>
</build>
</project>
有没有什么办法可以用maven干净地解决这个问题?