Maven and introduce some of the commands and Quick

Maven and introduce some of the commands

Maven: java platform to serve the project build and dependency management

Maven role:

1. Add the jar package (the original project jar package repeat, only in a local warehouse with Maven, you can need to coordinate reference)

2. Depending jar package (with maven can be downloaded directly dependent jar package)

3. Obtain third-party jar package (you can get to start a local warehouse, did not go to the central warehouse download)

4. The engineering project into multiple modules

 

Maven command:

  1. clean: remove target jar file
  2. compile: compile the project. Similar javac
  3. package: Package will only packaged engineering jar package into target directory but no local repository
  4. install: the installation package to the local repository jar (1234 performs the above sequence)

Configuring Maven eclipse

1. Quguan network: https: //maven.apache.org/download.cgi download apache-maven-3.6.2-bin.zip

 

 

2. Unzip to a directory path try not to have Chinese

3. In the eclipse-window-preferences-Maven-Installations in add just unzip the file path and choose.

4. Click Browse to select at Installtions extraction path following the User Setting \ conf \ settings.xml

5. Modify the default path Maven local repository:

After adding in the settings.xml localRepository comments

<LocalRepository> E: \\ software company \\ repMaven </ localRepository>

6. Modify the default jdk version used when Maven created:

After settings.xml add a comment in the profile:

    <profile> 

            <id>jdk-1.8</id> 

            <activation> 

                   <activeByDefault>true</activeByDefault> 

                <jdk>1.8</jdk> 

            </activation> 

            <properties> 

                   <maven.compiler.source>1.8</maven.compiler.source>

                   <maven.compiler.target>1.8</maven.compiler.target>

                   <maven.compiler.compilerVersion>1.8</maven.compiler.compilerVersion> 

            </properties> 

   </profile>

Creating the Maven Project

1. Go to the file-new-Project or Other search maven, double-click the Maven Project

 

 

 

2. Go to create a Maven Project screen, select create asimple project ..., select the workspace, click next

 

 

 

3. Set Group Id, Artifact Id (Group Id and Artifact Id two time coordinates, used to look after the project), Version (version) and Package (There jar (java project), war (web project), and pom (can project coming together)), click Finish to create the completed

 

 

 

After resolving Maven project to create a WEB-INF, web.xml and other documents the absence webapp

1. Right-click the project in order maven properties-project-facets, the Dynamic Web Module removing the hook and then Apply, then put on a Gogo, there will be a blue font Further configuration available in the following ....

 

 

 

2. click the blue font and then set the Content directory: / src / main / webapp Click OK enough

 

 

Guess you like

Origin www.cnblogs.com/kfsrex/p/11545909.html