![](/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.