People who have used Maven know that the directory structure of the MAVEN project is somewhat different from the traditional Dynamicweb project. Of course we do the best with Maven's specs, but what if you don't exactly follow Maven's specs and just need to use Maven to pack? In fact, it is simple, these can be changed by configuring the Pom file.
MAVEN Standard directory structure:
myproject/ |--pom.xml '--src |--main | | --java | | '--com | | '--mycompany | | -Resources | '--WebApp | | --Web-inf | | '--Web | '--index.jsp '--Test |--java | '--com | '--mycompany '--resources
above is a standard MAVEN directory structure, and regular Web project JSP, JS, CSS and other files are put into the webcontent/webroot. In Maven, these files are placed under WebApp. So, if you use Maven directly to install the package, your page related files will not be packaged in, you will find that the war package is only src. class files and some configuration files. So how to include pages and other files in it?
Very simply, you just tell Maven where your JSP is located and configure it as follows:
<build><finalName>projectName</finalName><plugins><plugin><groupId> Org.apache.maven.plugins</groupid><artifactid>maven-war-plugin</artifactid><version> 2.4</version><configuration><!--Specify the location of the Web. xml File--><webxml>webcontent\web-inf\web.xml </webXml><!--specify where files such as JSPs are located-- <warSourceDirectory>WebContent</warSourceDirectory> </configuration></plugin></plugins></build>
OK plus the above configuration, and then execute the install command, to be packaged, you will find that the WebContent files are all included in the war package. You can now copy the beaten war package to Tomcat and run it.
You might think that you'll have to manually copy the package to Tomcat, and you'll have to do it manually every time you pack it up. The next article will be with you to learn how to package with Maven and automatically deploy to Tomcat. A blog to learn a little better, we do not worry Oh!
The tool of the Novice tutorial use (ii)--maven a Web project that packages a non-canonical directory structure