IDEA 配置 maven

本文详细介绍了在IntelliJ IDEA中配置Maven的步骤,包括下载Maven,解压并修改配置文件,以及在IDEA中设置Maven路径和用户设置文件。通过这些步骤,可以确保IDEA使用自定义的Maven环境进行项目开发。

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

作为代码的搬运工~多阅读,学思考,多尝试,应该多输出,多总结。

IntelliJ IDEA maven配置

maven如今是idea当中必不可少的工具了,这里主要说明一下如何进行maven配置。

虽然idea有一些默认的maven配置,但是如果想要好用,最好还是自己配置一个maven。

idea maven配置的方法和步骤如下:

1、官方下载一个maven:

下载地址:http://maven.apache.org/download.html
https://maven.apache.org/download.cgi

找到 Binary zip archive => apache-maven-3.6.1-bin.zip,然后点击 apache-maven-3.6.1-bin.zip 进行下载,也可以直接点击下面的地址进行下载:

下载 apache-maven-3.6.1-bin.zip

历史版本:比如apache-maven-3.8.1-bin.zip的下载
在这里插入图片描述

2、将下载的文件解压到自己的安装目录,比如:

D:\appdev\maven\maven3.6

3、配置maven:

用编辑器打开文件 D:\appdev\maven\maven3.6\conf\settings.xml,并对文件里面的内容进行修改:

在 settings 的节点下增加镜像配置:

 <mirrors>
     <mirror>
      <id>alimaven</id>
      <name>aliyun maven</name>
      <url>http://maven.aliyun.com/nexus/content/groups/public/</url>
      <mirrorOf>central</mirrorOf>        
     </mirror>
  </mirrors>

4、修改idea 自带maven:

打开idea界面的setting配置,配置路径如下:

File | Settings | Build, Execution, Deployment | Build Tools | Maven

将 Maven home directory 修改为 D:\appdev\maven\maven3.6,User settings file 修改为 D:\appdev\maven\maven3.6\conf\settings.xml,并将 User settings file 后面的Override进行勾选(否则不生效),然后点击Apply或OK,保存一下。

以上内容查阅自 (http://www.dreamwu.com/post-43.html)

 http://www.dreamwu.com/post-43.html

我下载的版本是 apache-maven-3.8.4

我现在的配置是, 拿去用,需要修改的就是本地仓库了

<?xml version="1.0" encoding="UTF-8"?>

<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements.  See the NOTICE file
distributed with this work for additional information
regarding copyright ownership.  The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License.  You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied.  See the License for the
specific language governing permissions and limitations
under the License.
-->

<!--
 | This is the configuration file for Maven. It can be specified at two levels:
 |
 |  1. User Level. This settings.xml file provides configuration for a single user,
 |                 and is normally provided in ${
   user.home}/.m2/settings.xml.
 |
 |                 NOTE: This location can be overridden with the CLI option:
 |
 |                 -s /path/to/user/settings.xml
 |
 |  2. Global Level. This settings.xml file provides configuration for all Maven
 |                 users on a machine (assuming they're all using the same Maven
 |                 installation). It's normally provided in
 |                 ${
   maven.conf}/settings.xml.
 |
 |                 NOTE: This location can be overridden with the CLI option:
 |
 |                 -gs /path/to/global/settings.xml
 |
 | The sections in this sample file are intended to give you a running start at
 | getting the most out of your Maven installation. Where appropriate, the default
 | values (values used when the setting is not specified) are provided.
 |
 |-->
<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">
  <!-- localRepository
   | The path to the local repository maven will use to store artifacts.
   |
   | Default: ${
   user.home}/.m2/repository
  <localRepository>/path/to/local
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值