Maven's simple to understand

part1 Maven Getting Started

1. download, install, configure the environment variables
and then the address (. 1) https://maven.apache.org/download.cgi
(2) mounted JDK
(. 3) configure the environment variables
a, win + r open the Run window, enter cmd command window
b, type sysdm.cpl to open the system settings, click advanced and then click on the system variable
c, New variable MAVEN_HOME, pointing to the root directory maven
d, added a point in the path of the bin directory maven% MAVEN_HOME% \ bin

2. Local warehouse
One of the advantages is that management maven jar package (dependency management), stored in a local warehouse jar, the more the project, the more obvious advantages.
The default local repository address is C: \ Users \ username .m2 \ repository
storage address of the local maven repository can be modified to open the conf directory into the
settings file to modify

the last line is my own local repository settings can be modified according to your own hard disk

Local warehouse jar package is downloaded from a remote repository or central warehouse, usually with Ali cloud image, can also be set up in the country in the settings file, you can also set other third-party warehouse, such as the company's warehouse
central warehouse address http : //mvnrepository.com/ , according to their need to download

Part2 Maven command

3.Maven commonly used commands
a) clean: clean up the directory compiled
b) compile: compile, compile only main directory, the directory is not cheap test
c) test-compile: compile the test code in
d) test: running test code in
e) package: package
1, Java project -> labeled jar package
2, web project -> labeled as war package
f) install: publish the project to a local warehouse, used in the fight jar package, the package can be reached jar other use project

Lifecycle 4.Maven command
a) Clear the life cycle: the Clear
b) the Default life cycle: the compile, the compile-the Test, the Test, Package Penalty for, install
c) Site life cycle: site command to generate a static page document describing the project
d) different life cycle can be run together, for example, to clear and then compile

5.Maven command execution sequence
a) in the same command will lifecycle affected by the order of execution
will when the execution order compile b) Defalt life cycle, test-compile, test, package , install ( one run command it also performed before the command)

6.Scope dependent effect may also be referred to as a dependency range: maven vary in accordance with a program dependent on the stage and in which the scene, so to limit the scope attribute maven with
a) compile (default) compiling, running, testing, packaging, valid
b) provided: compile, test active
c) test: test only valid
d) runtime: run, test, package, effective
e) system: not recommended to use system scope will not seek to rely on local warehouse, to develop local path

Part3 Maven and hot deployment of Tomcat

Part4 use Maven integration framework ssm

Integration frame 1.Maven + ssm
a) was added ssm framework required depend
b) configuring the plug
c) introducing the desired profile frame ssm
d) configuration of resources released Maven Resources:
I, as will Maven src / main / java / under the ".java" files are compiled into target / clsses directory, but other files in the directory will be ignored
ii, Mabatis Mapper mapping file should be placed under src / main / java, we can not ignore
iii, so we needs to be filtered in the configuration file src / main / java, can not be ignored
iv, using the Resources tag may Maven proceeds configuration

Published 96 original articles · won praise 22 · views 40000 +

Guess you like

Origin blog.csdn.net/weixin_43751787/article/details/102756208