![](/img/trans.png)
[英]Eclipse The deployment descriptor of the module 'xxx.war' cannot be loaded or found
[英]Maven War: Filename of deployment descriptor
所以我已经将maven-war-plugin添加到我的pom.xml中并添加了:
<configuration>
<webXml>WEB-INF/glassfish-web.xml</webXml>
</configuration>
现在当我打包我的应用程序时,这个描述符被重命名为web.xml,这在尝试将我的应用程序部署到我的glassfish服务器时导致失败,因为服务器认为web.xml是错误格式化的。 那么如何告诉maven保持文件名不受影响?
<webXml>
配置对于maven-war-plugin
不是必需的。 因此,如果您没有明确提及webXml,它将不会重命名该文件。 如果从pom.xml
删除此webXml条目,您将获得预期的行为
编辑1
我认为没有选项可以跳过webXml文件重命名。 您可以在maven-resources plugin
尝试copy-resources任务。 您可以配置从Project dir到War archive的资源文件/目录映射。
<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/>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.