maven dividing a project's construction into different life cycles (Lifecycle) , this process includes: compiling, testing, packaging, integration testing, validation, deployment. All execution Actions (goal) in Maven need to indicate where they are executing in the process, and then when maven executes, In accordance with the development of the process calls these goal to do various processing.
Here are some of the problems that you will encounter when packing:
Maven using the plugin to dynamically hit War This error occurred in the package:
[ERROR] Failed to execute goal Org.apache.maven.plugins:maven-war-plugin:2.5:war (Default-war) on Project Mavenproj1: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 on the errors and possible solutions, please read the following articles:[error] [Help 1] https:// Cwiki.apache.org/confluence/display/maven/mojoexecutionexception
This means that the Web. XML file was not found when building the project , usually the root directory of the Maven Project We built is webapp, Now we change to the WebContent folder, so we need to specify the root directory of the site.
Directory:
WebApp
│- pom.xml
│
└─src
└─main
├─Resources
└─webapp
│ index.jsp
│
└─web-inf
Xml
Modify Pom File:
<build > <finalName>gx</finalName> <plugins> <plugin> <groupid>org.apach E.maven.plugins</groupid> <artifactId>maven-war-plugin</artifactId> <version> ;2.5</version> <configuration> <!--Specify the location of the Web. xml file, which is a way to--> ; <webXml>WebContent\WEB-INF\web.xml</webXml><!--Specify directory location, this is another way to put all the XML files in this directory into the JAR package--< !--<webResources> <resource> &NBSP ; <directory>webContent</directory> </resource> </webResources>--> </configuration> </plugin> </plugins>< ;/build>
These things are essential to our maven project, and this is mainly in the maven plugin mechanism,maven The plug-in mechanism is dependent on the Maven lifecycle.
MAVEN Live---Plug-in dynamic packaging