我的maven项目中有3个模块用于jar、war和ear包。在构建JAR文件时,我将一些XML文件添加到META目录中(比如jboss.xml或ejb-jar.xml)。如果我构建EAR,这个包包含jar文件,但是在META中没有XML文件.
我很困惑,因为我不知道怎么改变它。请帮帮忙
发布于 2019-11-14 18:21:26
示例maven项目
<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>fun</groupId>
<artifactId>fun</artifactId>
<version>1.0</version>
<packaging>ear</packaging>
<build>
<plugins>
<plugin>
<artifactId>maven-ear-plugin</artifactId>
<version>2.3.2</version>
<configuration>
<finalName>MyEarFile</finalName>
<version>5</version>
<generatedDescriptorLocation>${basedir}/src/main/application/META-INF</generatedDescriptorLocation>
<modules>
<webModule>
<groupId>fun</groupId>
<artifactId>fun</artifactId>
<uri>fun.war</uri>
<bundleFileName>fun.war</bundleFileName>
<contextRoot>/fun</contextRoot>
</webModule>
</modules>
</configuration>
</plugin> <plugin>
<artifactId>maven-resources-plugin</artifactId>
<version>2.4</version>
<configuration>
<encoding>UTF-8</encoding>
</configuration>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>fun</groupId>
<artifactId>fun</artifactId>
<version>1.0</version>
<type>war</type>
</dependency>
</dependencies>
</project>发布于 2013-09-12 17:59:16
最简单的解决方案是将适当的文件放入src/main/application文件夹。在META-INF的情况下,您可以简单地添加这个文件夹,即src/main/application文件夹,在打包之后,这些文件将打包到EAR文件中。
https://stackoverflow.com/questions/18765415
复制相似问题