Create a web project with maven

step

  The first step: to build a disk in a folder

  Step Two: Switch cmd into the newly built folder, for example: I built a hello folder in c drive (C: \ hello)

                 Execute command statement: cd C: \ hello

  Step 3: Create a web project

               Create a java project execution command statement: mvn archetype: generate -DgroupId = com.mycompany.app -DartifactId = my-app -DarchetypeArtifactId = maven-archetype-quickstart -DarchetypeVersion = 1.4 -DinteractiveMode = false

                This executes the statement and create a java implementation of the statement is almost the only difference is: If it is a web project -DarchetypeArtifactId into maven-archetype-webapp

               Create a web project Perform this statement: mvn archetype: generate -DgroupId = com.mycompany.app -DartifactId = my-app maven-archetype-webapp = maven-archetype-quickstart -DarchetypeVersion = 1.4 -DinteractiveMode = false

                    Note : No matter what project to create, execute statement com.mycompany.app (package name) and my-app (project name) modify

          

  Step four: Switch to the C: \ hello in the file myweb

             Execute command statement: cd myweb (previously switched C: \ hello directory, there is no need at times to switch to the C: \ hello, the direct switching of C: \ hello to the myweb file)

Step five: engineering package, use the command Package Penalty for mvn , the project will be packaged into a jar \ war \ ear, etc. Package

Step Six: Copy C: \ hello \ myweb \ myweb.war document under the target directory, copied to the C: \ apps \ under apache-tomcat-8.5.38 directory

Step Seven: Run C: \ apps \ apache-tomcat-8.5.38 \ shutdown.bat bin directory, double-click shutdown.bat

Step Eight: In the browser address bar: http: // localhost: 8080 / myweb

Guess you like

Origin www.cnblogs.com/hzyhx/p/10945302.html