Error assembling WAR: webxml attribute is required (or pre-existing WEB-INF/web.xml if executing in
2014-05-07 15:00
381 查看
今天一个web项目启动报错:错误信息如下
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-war-plugin:2.2:war (default-war) on project mafka-cms: Error assembling WAR: webxml attribute is required (or pre-existing WEB-INF/web.xml if executing in update mode)
-> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException
页面也无法正常显示,报404错误
原因说明:
maven的web项目默认的webroot是在src\main\webapps。如果在此目录下找不到web.xml就抛出以上的异常
解决方式:
在web工程pom.xml中增加plugin配置:
运行步骤:
1.maven clean
2.maven package
以下是构建成功日志,以供大家参考。
[WARNING] Command line option -npr is deprecated and will be removed in future Maven versions.
[INFO] Scanning for projects...
[INFO]
[INFO] Using the builder org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder with a thread count of 1
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building mafka-cms 1.0.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
Downloading: http://nexus:8081/nexus/content/groups/public-snapshots/com/xxx/mtrace/mtrace/1.0.5-SNAPSHOT/maven-metadata.xml
Downloaded: http://nexus:8081/nexus/content/groups/public-snapshots/com/xxx/mtrace/mtrace/1.0.5-SNAPSHOT/maven-metadata.xml (361 B at 1.8 KB/sec)
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ mafka-cms ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory /Users/lizhitao/mt_wp/mafka/mafka-cms/src/main/resources
[INFO]
[INFO] --- maven-compiler-plugin:2.5.1:compile (default-compile) @ mafka-cms ---
[INFO] Nothing to compile - all classes are up to date
[INFO]
[INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) @ mafka-cms ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 1 resource
[INFO]
[INFO] --- maven-compiler-plugin:2.5.1:testCompile (default-testCompile) @ mafka-cms ---
[INFO] Nothing to compile - all classes are up to date
[INFO]
[INFO] --- maven-surefire-plugin:2.12.4:test (default-test) @ mafka-cms ---
[INFO] Tests are skipped.
[INFO]
[INFO] --- maven-war-plugin:2.1.1:war (default-war) @ mafka-cms ---
[INFO] Packaging webapp
[INFO] Assembling webapp [mafka-cms] in [/Users/lizhitao/mt_wp/mafka/mafka-cms/target/mafka-cms]
[INFO] Processing war project
[INFO] Webapp assembled in [416 msecs]
[INFO] Building war: /Users/lizhitao/mt_wp/mafka/mafka-cms/target/mafka-cms.war
[INFO] WEB-INF/web.xml already added, skipping
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 3.871 s
[INFO] Finished at: 2014-05-07T15:36:33+08:00
[INFO] Final Memory: 12M/228M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-war-plugin:2.2:war (default-war) on project mafka-cms: Error assembling WAR: webxml attribute is required (or pre-existing WEB-INF/web.xml if executing in update mode)
-> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException
页面也无法正常显示,报404错误
原因说明:
maven的web项目默认的webroot是在src\main\webapps。如果在此目录下找不到web.xml就抛出以上的异常
解决方式:
在web工程pom.xml中增加plugin配置:
<plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-war-plugin</artifactId> <version>2.1.1</version>
<configuration> <webXml>src\main\webapps\WEB-INF\web.xml</webXml> </configuration> </plugin>
运行步骤:
1.maven clean
2.maven package
以下是构建成功日志,以供大家参考。
[WARNING] Command line option -npr is deprecated and will be removed in future Maven versions.
[INFO] Scanning for projects...
[INFO]
[INFO] Using the builder org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder with a thread count of 1
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building mafka-cms 1.0.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
Downloading: http://nexus:8081/nexus/content/groups/public-snapshots/com/xxx/mtrace/mtrace/1.0.5-SNAPSHOT/maven-metadata.xml
Downloaded: http://nexus:8081/nexus/content/groups/public-snapshots/com/xxx/mtrace/mtrace/1.0.5-SNAPSHOT/maven-metadata.xml (361 B at 1.8 KB/sec)
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ mafka-cms ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory /Users/lizhitao/mt_wp/mafka/mafka-cms/src/main/resources
[INFO]
[INFO] --- maven-compiler-plugin:2.5.1:compile (default-compile) @ mafka-cms ---
[INFO] Nothing to compile - all classes are up to date
[INFO]
[INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) @ mafka-cms ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 1 resource
[INFO]
[INFO] --- maven-compiler-plugin:2.5.1:testCompile (default-testCompile) @ mafka-cms ---
[INFO] Nothing to compile - all classes are up to date
[INFO]
[INFO] --- maven-surefire-plugin:2.12.4:test (default-test) @ mafka-cms ---
[INFO] Tests are skipped.
[INFO]
[INFO] --- maven-war-plugin:2.1.1:war (default-war) @ mafka-cms ---
[INFO] Packaging webapp
[INFO] Assembling webapp [mafka-cms] in [/Users/lizhitao/mt_wp/mafka/mafka-cms/target/mafka-cms]
[INFO] Processing war project
[INFO] Webapp assembled in [416 msecs]
[INFO] Building war: /Users/lizhitao/mt_wp/mafka/mafka-cms/target/mafka-cms.war
[INFO] WEB-INF/web.xml already added, skipping
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 3.871 s
[INFO] Finished at: 2014-05-07T15:36:33+08:00
[INFO] Final Memory: 12M/228M
[INFO] ------------------------------------------------------------------------
相关文章推荐
- Error assembling WAR: webxml attribute is required (or pre-existing WEB-INF/web.xml if executing in
- Error assembling WAR: webxml attribute is required (or pre-existing WEB-INF/web.xml if executing in
- Error assembling WAR: webxml attribute is required (or pre-existing WEB-INF/web.xml if executing in update mode) -> [Help 1]
- IDEA Error assembling WAR: webxml attribute is required (or pre-existing WEB-INF/web.xml if executin
- 【maven 报错】maven项目执行maven install时报错Error assembling WAR: webxml attribute is required (or pre-existing WEB-INF/web.xml if executing in update mode)
- Error assembling WAR: webxml attribute is required (or pre-existing WEB-INF/web.xml
- webxml attribute is required (or pre-existing WEB-INF/web.xml if executing in update mode)
- maven-install报错:webxml attribute is required (or pre-existing WEB-INF/web.xml if executing in update
- Maven打包web项目报错Error assembling WAR: webxml attribute is required (or pre-existing WEB-INF/web.xml if
- Maven报错:Error assembling WAR: webxml attribute is required (or pre-existing WEB-INF/web.xml
- Maven打包web项目报错Error assembling WAR: webxml attribute is required (or pre-existing WEB-INF/web.xml if
- Error assembling WAR: webxml attribute is required
- MAVEN: Error assembling WAR: webxml attribute is required
- SpringBoot发布WAR启动报错:Error assembling WAR: webxml attribute is required
- [WARNING] Warning: selected war files include a WEB-INF/web.xml which will be ignored (webxml attribute is missing from war task, or ignoreWebxml attribute is specified as 'true')
- eclipse maven error: Archive for required library in project cannot be read or is not a valid ZIP fi
- Maven部署Web项目报错webxml attribute is required
- If you encounter a maven error on your pom file saying web.xml is missing
- Parse error in application web.xml file at jndi:/localhost/WEB-INF/web.xml org.xml.sax.SAXParseExcep
- [Java][Maven]Maven部署Web项目报错webxml attribute is required