I started learning maven to build a project today. I don't want to make an error when building the first project (maven install). The error content is as follows:
[INFO] Scanning for projects... [WARNING] [WARNING] Some problems were encountered while building the effective model for com.cnp.x8:x8:war:0.1-SNAPSHOT [WARNING] 'build.plugins.plugin.version' for org.apache.maven.plugins:maven-surefire-plugin is missing. @ line 93, column 12 [WARNING] [WARNING] It is highly recommended to fix these problems because they threaten the stability of your build. [WARNING] [WARNING] For this reason, future Maven versions might no longer support building such malformed projects. [WARNING] [INFO] [INFO] ------------------------------------------------------------------------ [INFO] Building x8 Maven Webapp 0.1-SNAPSHOT [INFO] ------------------------------------------------------------------------ [INFO] [INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ x8 --- [INFO] Using 'UTF-8' encoding to copy filtered resources. [INFO] Copying 0 resource [INFO] [INFO] --- maven-compiler-plugin:2.5.1:compile (default-compile) @ x8 --- [INFO] Nothing to compile - all classes are up to date [INFO] [INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) @ x8 --- [INFO] Using 'UTF-8' encoding to copy filtered resources. [INFO] Copying 0 resource [INFO] [INFO] --- maven-compiler-plugin:2.5.1:testCompile (default-testCompile) @ x8 --- [INFO] Nothing to compile - all classes are up to date [INFO] [INFO] --- maven-surefire-plugin:2.12.4:test (default-test) @ x8 --- [INFO] Tests are skipped. [INFO] [INFO] --- maven-war-plugin:2.4:war (default-war) @ x8 --- [INFO] Packaging webapp [INFO] Assembling webapp [x8] in [W:\devTools\eclipse\workspace\maven\simple-webapp\target\x8] [INFO] Processing war project [INFO] Copying webapp resources [W:\devTools\eclipse\workspace\maven\simple-webapp\src\main\webapp] [INFO] Webapp assembled in [41 msecs] [INFO] Building war: W:\devTools\eclipse\workspace\maven\simple-webapp\target\x8.war [INFO] ------------------------------------------------------------------------ [INFO] BUILD FAILURE [INFO] ------------------------------------------------------------------------ [INFO] Total time: 2.198 s [INFO] Finished at: 2015-04-18T00:18:00+08:00 [INFO] Final Memory: 12M/170M [INFO] ------------------------------------------------------------------------ [ERROR] Failed to execute goal org.apache.maven.plugins:maven-war-plugin:2.4:war (default-war) on project x8: 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
Through Baidu, find the following:
However, in the current project, I have not found any trace of /WEB-INF/web.xml. I only saw it in the target when executing maven install for the first time. I did not notice that there is no trace of /main/webapp/ at that time. The specific reason has not been found yet. , the current solution: manually create the /main/webapp/WEB-INF/web.xml file.
Reason found:
1. There is no WEB-INF/web.xml (...quickstart) generated by default
2. The maven...webapp option should be selected