这是一个挑战:为什么这个构建失败了?
我已将 Maven 的 maven-war-plugin 配置为不会在缺失的 web.xml 文件上失败,看来:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<executions>
<execution>
<id>prepare-war</id>
<phase>prepare-package</phase>
<configuration>
<failOnMissingWebXml>false</failOnMissingWebXml>
<archiveClasses>false</archiveClasses>
<archive>
<manifest>
<addClasspath>true</addClasspath>
<classpathPrefix />
</manifest>
<manifestEntries>
<Implementation-Build>${build.number}</Implementation-Build>
<Implementation-Title>${project.name}</Implementation-Title>
<Built-By>${user.name}</Built-By>
<Built-OS>${os.name}</Built-OS>
<Build-Date>${build.date}</Build-Date>
</manifestEntries>
</archive>
<webResources>
<resource>
<!-- this is relative to the pom.xml directory -->
<directory>./target/dist</directory>
</resource>
</webResources>
</configuration>
</execution>
</executions>
</plugin>
但是尽管有这种配置,它仍然像这样失败:
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-war-plugin:2.4:war (default-war) on project com.specktro.orchid.operations.portal.frontend: Error assembling WAR: webxml attribute is required (or pre-existing WEB-INF/web.xml if executing in update mode) -> [Help 1]
我实际上没有 web.xml,所以我需要它来组装没有它的战争。
我尝试在配置中添加一个伪造<webXml>none</webXml>
的,但这并没有改变任何东西......
我错过了什么?