Maven study notes

Study notes

Select apache-maven-3.3 9-bin. Zip download and unzip. Configure environment variable: create a new environment variable m2_ Home, the value is the address of Maven decompression, for example: D: \ maven \ apache-maven-3.3 9 add after the value of the path variable;% M2_ HOME%\bin; Successful configuration verification: Win + R CMD enter MVN - V. if relevant information can appear, it will succeed.

src

Create folder and write file maven01 (project name)

MVN - V view the Maven version. MVN compile. MVN test. MVN package. MVN clean clears the target directory generated by Maven. MVN install installs the generated jar into the local repository.

Speak. java package com. imooc. maven02. util;

Open the CMD window under the project root directory (Shift + right click - > CMD), enter archetype: generate, and then follow the prompts to select (it will get stuck in a strange place, which can be solved by running MVN archetype: generate - dargetypecatalog = internal) choose a number or apply Filter appears. It seems that there are some templates in front of it, and press enter directly. Archetype: generate - dgourpid = organization name, reverse writing of company website + project name - dartifactid = project name - module name - dversion = version number - dpackage = package name of the code m vn archetype:generate -DarchetypeCatalog=internal -DgroupId=com. imooc. maven04 -DartifactId=maven04-demo -Dversion=1.0. 0-SNAPSHOT -Dpackage=com. imooc. maven04. demo -DarchetypeCatalog=internal

The construction is uniquely identified by coordinates, such as

(although eclipse comes with Maven plug-in. Right click New - > Maven project and select QuickStart to run: right click Run as - > Maven build... Goals in pom.xml, enter: compile and click Run____

Maven defines three sets of life cycles, which are independent of each other. Clean life cycle pre clean: perform the work before cleaning;

Maven's core distribution package is less than 3MB. Maven will download and use plug-ins when necessary. For the plug-ins themselves, in order to reuse code, they can often complete multiple tasks. Maven's life cycle is bound to plug-ins to complete the actual construction tasks. Specifically, the phases of the life cycle are bound to the objectives of the plug-in to complete a specific construction task.

1. Root element project

Different versions of components 1 Short circuit priority 2 If the path length is the same, who declares first and who resolves first______

Create a new Maven project, and select webapp in the filter to configure POM Add XML to servlet to configure jetty or Tomcat server

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>