所以我已经将maven-war-plugin添加到我的pom.xml中并添加:
Eclipse CDT4 - NMake Makefiles
= Generates Eclipse CDT 4.0 project files.
Eclipse CDT4 - MinGW Makefiles
= Generates Eclipse CDT 4.0 project files.
Eclipse CDT4 - Ninja = Generates Eclipse CDT 4.0 project files.
Eclipse CDT4 - Unix Makefiles= Generates Eclipse CDT 4.0 project files.
现在,当我打包我的应用程序时,此描述符被重命名为web.xml,这会导致尝试将应用程序部署到我的glassfish服务器时失败,因为我认为服务器认为web.xml格式错误。 那么,如何告诉Maven保持文件名不变?
答案 0 :(得分:0)
<webXml>
配置不是maven-war-plugin
的必需配置。因此,如果您未明确提及webXml,它将不会重命名该文件。如果从pom.xml
编辑1
我认为不存在跳过webXml文件重命名的选项。您可以在maven-resources plugin
中尝试 copy-resources 任务。您可以配置从项目目录到战争档案的资源文件/目录映射。
<plugins>
<-- other plugin configurations.... -->
<plugin>
<artifactId>maven-resources-plugin</artifactId>
<version>3.1.0</version>
<executions>
<execution>
<id>copy-resources</id>
<phase>prepare-package</phase>
<goals>
<goal>copy-resources</goal>
</goals>
<configuration>
<outputDirectory>
${basedir}/target/app/WEB-INF
</outputDirectory>
<resources>
<resource>
<directory>WEB-INF</directory>
<includes>glassfish-web.xml</includes>
</resource>
<resource>
<directory>{another directory from where all files are copied}
</directory>
</resource>
<resource>
<directory>
{another directory from where, all but test.properties are copied}
</directory>
<excludes>test.properties</excludes>
</resource>
</resources>
</configuration>
</execution>
</executions>
</plugin>
<plugins/>