Thirteen, Maven: Maven project of the new pom.xml file

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>

    <groupId>com.yust5273</groupId>
    <artifactId>maven-first-project</artifactId>
    <version>1.0-SNAPSHOT</version>

</project>

modelVersion: refers to the


15956200-795817b7c79e360e.png

groupId com. company's Web site name. department / project
artifactId function named
version version number of the
packaging are packaged by default jar

Parent pom of properties:


    <properties>
        <!-- Test -->
        <junit.contrib.version>1.16.1</junit.contrib.version>
    </properties>
使用

        <dependency>
            <groupId>com.github.stefanbirkner</groupId>
            <artifactId>system-rules</artifactId>
            <version>${junit.contrib.version}</version>
            <scope>test</scope>
        </dependency>
可以使用${标签名}来使用在<properties>标签里所定义的<标签>值</标签>
有什么用呢,可以作为全局变量来用,改变该全局变量的值,所有引用该全局变量的值也随着改变,方便维护

dependencyManagement:

  1. It can only appear in the parent pom
  2. Unified version number
  3. Statement (sub POM used again in the lead) is just a statement, if you need to use, but also need to introduce in the dependent sub-pom in, do not write version

Dependency

  1. Type default jar
  2. scope
    A) compiling the compile-Core e.g. Spring
    B) Test Test
    c) provided, for example, compiled servlet
    e.g. JDBC driver implemented d) runtime runtime
    e) system, for example, some local SMS jar jar
    F) dependent transmitting
    a first column represents a direct dependency scope, the first line indicates indirectly dependent scope
    the compile Test Runtime Provided
    the compile the compile - - Runtime
    Test Test - - Test
    Provided Provided - Provided Provided
    Runtime Runtime - - Runtime

============================
use mvn dependency: tree command to view the dependency tree

Reproduced in: https: //www.jianshu.com/p/ec2ff5046bff

Guess you like

Origin blog.csdn.net/weixin_34122810/article/details/91318831