Maven安装配置及IDEA配置

Maven是基于Java的项目管理工具,可对Java项目进行构建和依赖管理。使用Maven需安装对应JDK,不同版本Maven对JDK版本有不同要求。本文介绍了下载解压Maven、修改配置文件、配置环境变量、验证安装,还提及了IDEA配置。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

Maven 是一个基于 Java 的项目管理工具,可以对 Java 项目进行构建、依赖管理,所以使用maven首先需要安装对应的JDK。

Maven 3.3 要求 JDK 1.7 或以上
Maven 3.2 要求 JDK 1.6 或以上
Maven 3.0/3.1 要求 JDK 1.5 或以上

1、下载并解压Maven

下载maven的bin文件并解压在目录中,目录路径避免中文、特殊字。
在这里插入图片描述下载地址:http://maven.apache.org/download.cgi

2、修改配置文件

修改conf目录里面的settings.xml配置文件

<?xml version="1.0" encoding="UTF-8"?>
<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 http://maven.apache.org/xsd/settings-1.0.0.xsd">

  <!--配置maven本地仓库位置-->
  <localRepository>D:/Java/Installation Package/apache-maven-3.6.3/repository</localRepository>
          
  <pluginGroups></pluginGroups>

  <proxies></proxies>

  <servers></servers>

  <mirrors> 
  
    <!--阿里云的镜像-->
    <mirror>
      <id>alimaven</id>
      <name>aliyun maven</name>
      <url>http://maven.aliyun.com/nexus/content/groups/public/</url>
      <mirrorOf>central</mirrorOf>
    </mirror>
    
    <!--中央仓库在中国的位置-->
    <mirror>
      <id> maven-net-cn</id>
      <name> Maven China Mirror</name>
      <url> http://maven.net.cn/content/groups/public/</url>
      <mirrorOf>central</mirrorOf>
    </mirror>
    
  </mirrors>

  <profiles>
  
    <!--配置jdk的版本-->
    <profile>
      <id>jdk-1.8</id>
      <activation>
        <activeByDefault>true</activeByDefault>
        <jdk>1.8</jdk>
      </activation>
      <properties>
        <maven.compiler.source>1.8</maven.compiler.source>
        <maven.compiler.target>1.8</maven.compiler.target>
        <maven.compiler.compilerVersion>1.8</maven.compiler.compilerVersion>
      </properties>
    </profile>
    
 </profiles>
 
</settings>

3、配置Maven环境变量

添加 MAVEN_HOME系统变量
在这里插入图片描述
修改系统变量的Path,添加 %MAVEN_HOME%\bin
在这里插入图片描述

4、验证

打开cmd,输入 mvn --version ,输出如下信息代表成功
在这里插入图片描述
5、IDEA配置
在这里插入图片描述

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值