maven构建报错:
Caused by: org.apache.maven.plugin.MojoExecutionException: Error assembling WAR: webxml attribute is required (or pre-existing WEB-INF/web.xml if executing in update mode) at org.apache.maven.plugin.war.WarMojo.execute(WarMojo.java:191) at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:132) at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:208) ... 20 more Caused by: org.codehaus.plexus.archiver.ArchiverException: webxml attribute is required (or pre-existing WEB-INF/web.xml if executing in update mode) at org.codehaus.plexus.archiver.war.WarArchiver.initZipOutputStream(WarArchiver.java:162) at org.codehaus.plexus.archiver.zip.AbstractZipArchiver.createArchiveMain(AbstractZipArchiver.java:309) at org.codehaus.plexus.archiver.zip.AbstractZipArchiver.execute(AbstractZipArchiver.java:211) at org.codehaus.plexus.archiver.AbstractArchiver.createArchive(AbstractArchiver.java:944) at org.apache.maven.archiver.MavenArchiver.createArchive(MavenArchiver.java:598) at org.apache.maven.plugin.war.WarMojo.performPackaging(WarMojo.java:244) at org.apache.maven.plugin.war.WarMojo.execute(WarMojo.java:175)
原因:构建项目的WEB-INF目录下找不到web.xml
1、创建web.xml文件
2、不创建web.xml文件加入以下代码
<plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-war-plugin</artifactId> <version>2.6</version> <configuration> <failOnMissingWebXml>false</failOnMissingWebXml> </configuration> </plugin> </plugins>
标签:pre,WEB,assembling,java,xml,maven,web,apache,org From: https://www.cnblogs.com/wpcnblog/p/16612992.html