Intellij IDEA安装Maven(非常详细)

2023-10-27

安装Maven

安装路径:点击链接进去直接下载所需的版本Maven官网
http://maven.apache.org/download.cgi

最新版本下载方式

1、点击链接进入Maven官网
2、找到左侧栏的Download找到Files下载即可

二、所有版本的下载方式(里面新老版本都有)
1、点击链接进入Maven官网
2、找到左侧栏的Download
3、查看图二中箭头所指向的archives点击进去里面有所有的版本
4、找到需要的版本号进行对应下载

在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述

环境变量设置

找到系统变量的方式:
3、 此电脑 —>右击找到属性—>右击选中高级系统设置—>系统属性下找到环境变量进行配置系统变量
在这里插入图片描述

在这里插入图片描述

在这里插入图片描述
在这里插入图片描述
输入命令 mvn -v说明成功(要在绝对路径下)
在这里插入图片描述
四、配置setting.xml文件
1、在E:LearnMavenapache-maven-3.5.4conf下可以找到settings文件

2、找到第55行,这里是maven默认的仓库(在解压的路径下面去添加一个空的repo文件)
在这里插入图片描述
3、55行设置的repo路径之后变成默认选中这个路径、
在这里插入图片描述
4、因为国外的服务器下载jar包很慢所以我们改为阿里云服务器(大约在150行左右),这两个仓库只用选一个(根据大家反馈建议使用第一个,第二个在有的版本可能会出现warning)

<!-- 阿里云仓库 -->
        <mirror>
            <id>alimaven</id>
            <mirrorOf>central</mirrorOf>
            <name>aliyun maven</name>
            <url>http://maven.aliyun.com/nexus/content/repositories/central/</url>
        </mirror>
     或者
      <mirror>
		<id>nexus-aliyun</id>
		<mirrorOf>*</mirrorOf>
        <name>Nexus aliyun</name>
        <url>http://maven.aliyun.com/nexus/content/groups/public</url>
	 </mirror>

5、如何所示操作,需要放在mirrors中间,不可随意乱放
在这里插入图片描述
最后配置jdk,也要夹在两个profiles标签之间(我这里使用的为jdk8)
在这里插入图片描述
总的如下:

<?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/repo</localRepository>
  -->
    <localRepository>E:LearnMavenapache-maven-3.5.4
epo</localRepository>

  <!-- interactiveMode
   | This will determine whether maven prompts you when it needs input. If set to false,
   | maven will use a sensible default value, perhaps based on some other setting, for
   | the parameter in question.
   |
   | Default: true
  <interactiveMode>true</interactiveMode>
  -->

  <!-- offline
   | Determines whether maven should attempt to connect to the network when executing a build.
   | This will have an effect on artifact downloads, artifact deployment, and others.
   |
   | Default: false
  <offline>false</offline>
  -->

  <!-- pluginGroups
   | This is a list of additional group identifiers that will be searched when resolving plugins by their prefix, i.e.
   | when invoking a command line like "mvn prefix:goal". Maven will automatically add the group identifiers
   | "org.apache.maven.plugins" and "org.codehaus.mojo" if these are not already contained in the list.
   |-->
  <pluginGroups>
    <!-- pluginGroup
     | Specifies a further group identifier to use for plugin lookup.
    <pluginGroup>com.your.plugins</pluginGroup>
    -->
  </pluginGroups>

  <!-- proxies
   | This is a list of proxies which can be used on this machine to connect to the network.
   | Unless otherwise specified (by system property or command-line switch), the first proxy
   | specification in this list marked as active will be used.
   |-->
  <proxies>
    <!-- proxy
     | Specification for one proxy, to be used in connecting to the network.
     |
    <proxy>
      <id>optional</id>
      <active>true</active>
      <protocol>http</protocol>
      <username>proxyuser</username>
      <password>proxypass</password>
      <host>proxy.host.net</host>
      <port>80</port>
      <nonProxyHosts>local.net|some.host.com</nonProxyHosts>
    </proxy>
    -->
  </proxies>

  <!-- servers
   | This is a list of authentication profiles, keyed by the server-id used within the system.
   | Authentication profiles can be used whenever maven must make a connection to a remote server.
   |-->
  <servers>
    <!-- server
     | Specifies the authentication information to use when connecting to a particular server, identified by
     | a unique name within the system (referred to by the 'id' attribute below).
     |
     | NOTE: You should either specify username/password OR privateKey/passphrase, since these pairings are
     |       used together.
     |
    <server>
      <id>deploymentRepo</id>
      <username>repouser</username>
      <password>repopwd</password>
    </server>
    -->

    <!-- Another sample, using keys to authenticate.
    <server>
      <id>siteServer</id>
      <privateKey>/path/to/private/key</privateKey>
      <passphrase>optional; leave empty if not used.</passphrase>
    </server>
    -->
  </servers>

  <!-- mirrors
   | This is a list of mirrors to be used in downloading artifacts from remote repositories.
   |
   | It works like this: a POM may declare a repository to use in resolving certain artifacts.
   | However, this repository may have problems with heavy traffic at times, so people have mirrored
   | it to several places.
   |
   | That repository definition will have a unique id, so we can create a mirror reference for that
   | repository, to be used as an alternate download site. The mirror site will be the preferred
   | server for that repository.
   |-->
  <mirrors>
    <!-- mirror
     | Specifies a repository mirror site to use instead of a given repository. The repository that
     | this mirror serves has an ID that matches the mirrorOf element of this mirror. IDs are used
     | for inheritance and direct lookup purposes, and must be unique across the set of mirrors.
     |
    <mirror>
      <id>mirrorId</id>
      <mirrorOf>repositoryId</mirrorOf>
      <name>Human Readable Name for this Mirror.</name>
      <url>http://my.repository.com/repo/path</url>
    </mirror>
     -->
	  <!-- 阿里云仓库 -->
        <mirror>
            <id>alimaven</id>
            <mirrorOf>central</mirrorOf>
            <name>aliyun maven</name>
            <url>http://maven.aliyun.com/nexus/content/repositories/central/</url>
        </mirror>
	
  </mirrors>

  <!-- profiles
   | This is a list of profiles which can be activated in a variety of ways, and which can modify
   | the build process. Profiles provided in the settings.xml are intended to provide local machine-
   | specific paths and repository locations which allow the build to work in the local environment.
   |
   | For example, if you have an integration testing plugin - like cactus - that needs to know where
   | your Tomcat instance is installed, you can provide a variable here such that the variable is
   | dereferenced during the build process to configure the cactus plugin.
   |
   | As noted above, profiles can be activated in a variety of ways. One way - the activeProfiles
   | section of this document (settings.xml) - will be discussed later. Another way essentially
   | relies on the detection of a system property, either matching a particular value for the property,
   | or merely testing its existence. Profiles can also be activated by JDK version prefix, where a
   | value of '1.4' might activate a profile when the build is executed on a JDK version of '1.4.2_07'.
   | Finally, the list of active profiles can be specified directly from the command line.
   |
   | NOTE: For profiles defined in the settings.xml, you are restricted to specifying only artifact
   |       repositories, plugin repositories, and free-form properties to be used as configuration
   |       variables for plugins in the POM.
   |
   |-->
  <profiles>
    <!-- profile
     | Specifies a set of introductions to the build process, to be activated using one or more of the
     | mechanisms described above. For inheritance purposes, and to activate profiles via <activatedProfiles/>
     | or the command line, profiles have to have an ID that is unique.
     |
     | An encouraged best practice for profile identification is to use a consistent naming convention
     | for profiles, such as 'env-dev', 'env-test', 'env-production', 'user-jdcasey', 'user-brett', etc.
     | This will make it more intuitive to understand what the set of introduced profiles is attempting
     | to accomplish, particularly when you only have a list of profile id's for debug.
     |
     | This profile example uses the JDK version to trigger activation, and provides a JDK-specific repo.
    <profile>
      <id>jdk-1.4</id>

      <activation>
        <jdk>1.4</jdk>
      </activation>

      <repositories>
        <repository>
          <id>jdk14</id>
          <name>Repository for JDK 1.4 builds</name>
          <url>http://www.myhost.com/maven/jdk14</url>
          <layout>default</layout>
          <snapshotPolicy>always</snapshotPolicy>
        </repository>
      </repositories>
    </profile>
    -->

    <!--
     | Here is another profile, activated by the system property 'target-env' with a value of 'dev',
     | which provides a specific path to the Tomcat instance. To use this, your plugin configuration
     | might hypothetically look like:
     |
     | ...
     | <plugin>
     |   <groupId>org.myco.myplugins</groupId>
     |   <artifactId>myplugin</artifactId>
     |
     |   <configuration>
     |     <tomcatLocation>${tomcatPath}</tomcatLocation>
     |   </configuration>
     | </plugin>
     | ...
     |
     | NOTE: If you just wanted to inject this configuration whenever someone set 'target-env' to
     |       anything, you could just leave off the <value/> inside the activation-property.
     |
    <profile>
      <id>env-dev</id>

      <activation>
        <property>
          <name>target-env</name>
          <value>dev</value>
        </property>
      </activation>

      <properties>
        <tomcatPath>/path/to/tomcat/instance</tomcatPath>
      </properties>
    </profile>
    -->
	
	<!-- java版本 --> 
	<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>

  <!-- activeProfiles
   | List of profiles that are active for all builds.
   |
  <activeProfiles>
    <activeProfile>alwaysActiveProfile</activeProfile>
    <activeProfile>anotherAlwaysActiveProfile</activeProfile>
  </activeProfiles>
  -->
</settings>

在这里插入图片描述
然后还有最后一个问题,默认创建maven项目是下载网络上的一个文件archetype-catalog.xml,该文件的大小有5-6M,下载的速度很慢,导致创建过程也变得很慢。所以我们需要配置一下。当然,这里解决的方法有三种,这里我选择最容易的一种,就是修改maven的VM Options参数配置。
-DarchetypeCatalog=internal
在这里插入图片描述

测试Maven

回到主界面,点击New Project,然后我们创建一个maven项目
在这里插入图片描述
在这里插入图片描述

有阿里云连接说明成功
在这里插入图片描述

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

Intellij IDEA安装Maven(非常详细) 的相关文章

随机推荐

  • 智能家居_串口通信编程

    模拟串口 我要使用串口开发 那么 安卓系统必须要Root 让我有超级权限 串口就是文件 首先要打开串口文件 我们没有实体开发主板 使用虚拟串口驱动来代替实体开发主板 模拟android主板上的2个串口 模拟 开发板 插入了电脑 电脑就会显示
  • 2020东南大学网络空间安全保研夏令营(预推免)经验

    2020东南大学网安院保研夏令营 预推免 经验 前言 个人情况 本科某双非双一流CS专业 GPA 1 230 国家级省级奖项各有四五项 校级奖项若干 奖学金若干 项目只有一个大创 无论文 东大网安院说来话长 本来是不想报的 然鹅计算机学院的
  • mavne install 报错org.apache.maven.surefire.util.SurefireReflectionException: java.lang.reflect.Invoca...

    maven install 报错 org apache maven surefire util SurefireReflectionException java lang reflect InvocationTargetException
  • java校验文件路径正则表达式_正则表达式判断是否是合法路径

    在页面前端使用一个文本框 输入条件是 c test 在java中File判断是可以通过的 可以创建的 File file new File filePath if file exists file mkdir 说明是一个合法的路径 但是在w
  • 哈师大计算机学院宿舍,新生攻略

    原标题 新生攻略 哈师大所有的 秘密 都在这了 你好 我是哈师大17级的新生 我想全面的了解一下咱们学校 应该去哪了解呀 这你可算是问对人了 听说最近哈尔滨师范大学学生会的官方微信平台出了非常全的新生攻略呢 快关注它们的公众号 hsdxsh
  • Linux系列

    测试代码如下 是一个输出 Tinywan字符串与循环轮数的死循环程序 每输出一行就休眠1秒 原始输出 前台执行该程序运行效果 程序每隔一秒会在终端输出一个字符串 此时如果键入 Ctrl C 程序会收到一个 SIGINT信号 如果不做特殊处理
  • APT 攻击溯源方法

    概述 当今世界正值百年未有之大变局 网络空间成为继陆 海 空 天之后的第五大疆域 安全威胁也随之延伸至网络空间 没有网络安全就没有国家安全 在新时代网络空间安全已经上升至国家安全的高度 高级持续性威胁 Advanced Persistent
  • #PCIE# PCIE基础知识篇(3)

    写在前面 本文章转载自老狼知乎 感谢分享 随着AMD新一代CPU的发布 PCIe 4 0 Gen4 也进入了人们的视线 然而Intel随后宣传PCIe 4 0对消费市场用处不大 AMD则反讽Intel吃不到葡萄说葡萄酸 正在吃瓜群众搬板凳看
  • could not find an available, non-overlapping IPv4 address pool among the defaults to assign to the n

    如果你在创建自定义网络时 docker network create driver bridge my net出现下面的提示 Error response from daemon could not find an available no
  • 【Vue3项目】登录注册--双Token机制

    目录 前言 什么是双Token机制 双Token的实现流程 前言 最近同项目的伙伴告诉我们一个 新词汇 双Token登录机制 emmmmm 确实没了解过 据说是在实现token长期有效的同时 防止token被第三方盗用 提高用户信息的安全性
  • ReactNative系列之十三WebStorm的JSX语法配置及自动补全设置

    1 开发ReactNative常用工具 WebStorm Sublime Atom 2 配置WebStorm的ReactNative语法 a 下载 git clone https github com virtoolswebplayer R
  • ES 搜索20 (function_score 和 field_value_factor 自定义评分)

    自定义评分 设想有个网站供用户发布博客并且可以让他们为自己喜欢的博客点赞 我们希望将更受欢迎的博客放在搜索结果列表中相对较上的位置 同时全文搜索的评分仍然作为相关度的主要排序依据 可以简单的通过存储每个博客的点赞数来实现它 在搜索时 可以将
  • DHCP协议及其实验(eNSP)

    目录 一 DHCP 1 1 DHCP作用 1 2 DHCP地址池 1 3 DHCP报文类型 1 4 DHCP工作原理 对DHCP工作原理的思考 1 5 DHCP租期更新 1 6 DHCP重绑定 1 7 IP地址释放 二 DHCP实验 2 1
  • C++控制台RPG游戏:对话系统

    具体实现思路 CTalk类继承窗口基类 里面封装了updata 和onRander 方法 里面包含了结构体SArrTalk m pArrTalk 用来存对话数据 CTalk类控制对话的进行 以及数据的渲染 而对话的内容则存在相应的文件之中
  • 使用OpenCV,Haar级联检测器进行面部、眼睛、嘴部检测

    使用OpenCV Haar级联检测器进行面部 眼睛 嘴部检测 1 效果图 2 原理 2 1 Haar级联是什么 2 2 Haar级联的问题与局限性 2 3 Haar级联预训练的模型 3 源码 3 1 图像检测 3 2 实时视频流检测 参考
  • 【进阶】使用Excel进行回归分析,预测真实值

    预备阅读 进阶 使用Excel进行相关分析 前言 昨天学习了Excel中的相关分析 在数据分析中 相关分析和回归分析关系紧密 今天来学习下Excel中的回归分析 回归分析 回归分析 regressionanalysis 是确定两种或两种以上
  • 向量大小和归一化(vector magnitude & normalization)、向量范数(vector norm)、标量/向量/矩阵/张量

    一 向量大小 首先一个向量的长度或者大小一般记为 上图中的平面向量的大小计算如下 空间向量的大小计算如下 维复向量的大小计算如下 二 向量归一化 向量归一化即将向量的方向保持不变 大小归一化到1 向量的归一化向量为 三 向量范数 范数是一种
  • ant design pro上传图片到后端

    我们这里是前端将图片上传到后端 然后后端这里再上传到阿里云的OSS 并返回一个文件的路径给前端 先看效果 上传后生成的图片 前端 pageList js const props name avatar listType picture ca
  • Servlet基础_0300_Cookie

    web服务器和Client基础 1 web服务器可以向客户端写内容 2 web服务器向客户端写的内容只能是文本文件 3 浏览器客户端可以阻止web服务器写入东西 4 web服务器端的servlet只能拿自己webapp的写入的内容 Cook
  • Intellij IDEA安装Maven(非常详细)

    安装Maven 安装路径 点击链接进去直接下载所需的版本Maven官网 http maven apache org download cgi 最新版本下载方式 1 点击链接进入Maven官网 2 找到左侧栏的Download找到Files下