系统开始学后端

Maven的简单使用

2019-03-20  本文已影响1人  DeeJay_Y

安装

新建M2_HOME环境变量为maven的路径,添加%M2_HOME%\bin到系统环境变量path中

<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0
                          https://maven.apache.org/xsd/settings-1.0.0.xsd">

      <mirrors>
        <mirror>
            <id>alimaven</id>
            <name>aliyun maven</name>
            <url>http://maven.aliyun.com/nexus/content/groups/public/</url>
            <mirrorOf>central</mirrorOf>
        </mirror>
      </mirrors>
      <!-- 修改maven下载jar到本地的仓库路径 -->
      <localRepository>E:\MavenRepository</localRepository>
</settings>

基本概念

pom.xml大概如下:

<?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>learnMaven</groupId>
    <artifactId>maven-demo</artifactId>
    <version>1.0-SNAPSHOT</version>

    <dependencies>
        <!-- https://mvnrepository.com/artifact/commons-io/commons-io -->
        <dependency>
            <groupId>commons-io</groupId>
            <artifactId>commons-io</artifactId>
            <version>2.6</version>
        </dependency>
    </dependencies>

</project>

修改pom.xml,新增

<properties>
        <maven.compiler.source>10</maven.compiler.source>
        <maven.compiler.target>1.10</maven.compiler.target>
</properties>
上一篇 下一篇

猜你喜欢

热点阅读