Basic use of mvn

1) mvn command

   mvn -v: View maven version information

   compile: compile

   test: test

   package: package

 

 

   clean: delete target compiled files

   install: install the jar package into the local repository

 

 

2) mvn plugin to create a project

  In the directory where the project needs to be created, run

  mvn archetype:generate

  Follow the prompts to choose,

  A maven project can be created automatically.

 

  Another way to create

  mvn archetype:generate -DgroupId=organization name,

-DartifactId=project module name

-Dversion=version number

-Dpackage=package name where the code is located

 

3) maven coordinates and warehouse

  (coordinate component)

 

  storehouse:

Divided into: local warehouse and remote warehouse (http://repo.maven.apache.org/maven2/)

 

   mirror repository

Setting address: conf/settings.xml in the maven folder,

Modify the content of the mirrors tag.

 

   Change repository location:

        m is stored in the .m2 folder under the current user by default.

 

Modification: Also in conf/settings.xml under the maven folder,

Find the localRepository label and modify it to the path that needs to be stored.

 

Suggestion: Put the modified setting file in the new path, so that it can be copied directly when maven is updated.

 

 

4) eclipse integration

    After installing the plug-in, you need to modify the .ini file of eclipse and add the -vm option (the content asks javaw.exe in the bin directory of the jdk file).

 

    If you need to modify the warehouse location, in the eclipse options, find the user setting of maven, and modify it to the new warehouse setting file.

 

Run the maven project, select the pom.xml file, right-click and select run as (maven build)



 

 

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326518193&siteId=291194637