[Maven study notes] basic commands of maven

repository  --> Repository, when adding dependencies to pom.xml, maven will first go to the local repository to find the relevant jar package, if not locally, it will be from the central factory http://repo.maven.apache.org/maven2 Download the required jar package and download it to the .m2 folder in the user directory by default. By default, there are no other directories and files in the ~/.m2 directory except the repository repository, but most Maven users will need to copy the M2_HOME/conf/settings.xml file to ~/.m2/settings.xml. This is a best practice .
 
If you want to modify the local warehouse address, you can modify the settings.xml in the conf folder in the maven installation directory, as follows:
<localRepository>/path/to/local/repo</localRepository>
 Modify the path in it to the path you want to define, such as:
<localRepository>E:/maven/repo</localRepository>
 And copy the modified settings.xml to the E:/maven folder.
 
mvn compile  --> compile source code
mvn test  --> automatically run unit tests in the test package
mvn clean  --> clear the build results in the project directory
mvn package  --> type the project into a jar package and put it in the target directory
mvn install   --> type the project into a jar package and put it in the local repository so that other projects can call it.
mvn archetype:generate  -DgroupId=com.ztchen.maven -DartifactId=maven-ch03 -Dversion=0.0.1-SNAPSHOT --> to create a project, which is normally created in this way .
mvn archetype:create  --> This is the maven 2.x version and can also be used to create projects, but create is an abandoned or deprecated plugin, so try to use the above.
mvn eclipse:eclipse  --> Build the directory structure of the project into the directory structure of eclipse, so that it can be imported into eclipse.
mvn deploy --> project release (published to the private server)

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=326842121&siteId=291194637