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

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 athttp://www.apache.org/licenses/LICENSE-2.0Unless 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>D:\soft\Maven\apache-maven-3.8.4</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>--><!--国内镜像源--><!--阿里maven--><mirror><id>alimaven</id><name>aliyun maven</name><url>http://maven.aliyun.com/nexus/content/groups/public/</url><!--阿里maven的地址--><mirrorOf>central</mirrorOf></mirror><mirror><id>nexus-aliyun</id><mirrorOf>*</mirrorOf><name>Nexus aliyun</name><url>http://maven.aliyun.com/nexus/content/groups/public</url></mirror><!--  阿里云镜像加速默认的远程仓库 使用aliyun镜像来加速默认的官方远程仓库
--><mirror><id>aliyun</id><mirrorOf>central</mirrorOf><name>Nexus aliyun</name><url>http://maven.aliyun.com/nexus/content/groups/public</url></mirror><!-- 中央仓库1 --><mirror><id>repo1</id><mirrorOf>central</mirrorOf><name>Human Readable Name for this Mirror.</name><url>http://repo1.maven.org/maven2/</url></mirror><!-- 中央仓库2 --><mirror><id>repo2</id><mirrorOf>central</mirrorOf><name>Human Readable Name for this Mirror.</name><url>http://repo2.maven.org/maven2/</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>--><!--修改maven默认的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><!-- activeProfiles| List of profiles that are active for all builds.|<activeProfiles><activeProfile>alwaysActiveProfile</activeProfile><activeProfile>anotherAlwaysActiveProfile</activeProfile></activeProfiles>-->
</settings>

PS:先扫描本地仓库,如果,没有所需jar ,则取远程仓库 寻找 。

Ps:配置多个远程仓库时,如果在一个远程找不到,会去其它的远程仓库找(即 多个仓库遍历),所以尽量在这配置多少个远程仓库,默认会有一个ID是central的官方远程仓库。

PS:配置多个镜像时,只会寻找最先匹配的镜像,不会遍历所有镜像

全局默认的远程仓库

central
https://repo1.maven.org/maven2/

IDEA 中Maven 配置

针对当前项目所配

针对未来创建新项目所做的设置,这样以后,可不用频繁设置

使用maven创建的 web项目的结构

首次创建项目,耐心一点,因为IDEA要下载相应的插件,时间会久一点

约定>配置>编码

推荐
更加的一篇博文

https://blog.csdn.net/qq_42057154/article/details/106114515

IDEA 配置 maven相关推荐

  1. Maven安装与配置(最实用!!!)eclipse中配置maven

    Maven安装与配置 一.需要准备的东西 JDK Eclipse(本章主要是在eclipse中进行配置maven) Maven程序包 二.下载与安装 1. 前往maven下载最新版的Maven程序: ...

  2. Mac下配置Maven

    1.Java环境变量设置就不说. 但是配置Maven需要检查下Java环境变量的设置.需要检查JAVA_HOME环境变量以及Java命令 wanyakundeMacBook-Pro:Library w ...

  3. IDEA 配置maven

    编写Maven的settings.xml文件内容如下 引入阿里镜像和maven在中国的中央仓库镜像 <?xml version="1.0" encoding="UT ...

  4. Eclipse_Eclipse下配置Maven

    检查JAVA_HOME环境变量 C:\Users\Administrator>echo %JAVA_HOME% 解压Maven核心程序安装包,放在一个非中文无空格的路径下 D:\apache-m ...

  5. eclipse配置Maven中的Tomcat的使用

    pom文件配置maven插件 <build><pluginManagement><plugins><plugin><groupId>org. ...

  6. IDEA配置maven报错解决方案

    IDEA配置maven报错解决方案 参考文章: (1)IDEA配置maven报错解决方案 (2)https://www.cnblogs.com/7758521gorden/p/8778496.html ...

  7. Eclipse如何导入maven项目,以及配置maven

    Eclipse如何导入maven项目,以及配置maven 一.准备工作 1. eclipse,安装了eclipse 2. 一个需要导入的maven项目 3. 下载好了的压缩包apache-maven- ...

  8. Eclipse配置 Maven 异常处理

    问题简述 在配置Maven的时候,出现异常 Could not lookup required component com.google.inject.ProvisionException: Guic ...

  9. jdk jenkins 配置ant_安装配置maven、ant(Jenkins)

    系统(需要先安装配置JDK) 3.解压到C盘(无需安装) 4.配置环境变量 4.1用户环境变量 MAVEN_HOME (解压路径) 4.2系统环境变量 4.3验证环境变量是否配置成功,cmd命令行下输 ...

  10. eclipse中配置Maven仓库

    一.解压下载好的Maven核心程序到非中文的文件夹中 二.配置Maven环境变量 1.配置maven之前必须有jdk的环境: 2.配置M2_HOME 新建M2_HOME变量: 配置path的值 3.配 ...

最新文章

  1. c++之openGL在VS中的配置及简单图形绘制
  2. OpenGL学习脚印: 投影矩阵和视口变换矩阵
  3. tomcat环境变量参数catalina.home和catalina.base的设置位置
  4. [翻译]SQL Server 2005 Analysis Services性能指南
  5. Linux内存初始化(一)
  6. C++ - 编写一个从字符串转变成长整型的函数
  7. Scala项目启动方式:extends App和main的区别
  8. python异常处理时所使用的保留字_Python中,下列哪个保留字不用于异常处理______________。_学小易找答案...
  9. 粒子群算法求解带约束优化问题 源码实现
  10. 宝塔反代默认缓存了html吗,宝塔面板安装 OneList 设置反代
  11. java 线程的理解_Java多线程基础理解
  12. 前端面试准备---浏览器和网络篇(一)
  13. Linux(Ubuntu)使用日记------ssh远程登录腾讯云
  14. 《JavaScript语言精粹》笔记(内附《JavaScript语言精粹》百度云下载链接)
  15. c++编译提示:系统找不到指定路径
  16. java源程序的文件名必须与,Java源程序的文件名一定要与文件中某个类的名称一致。()...
  17. 《我要进大厂》之mysql夺命连环13问
  18. 计算机专业29岁研究生毕业,26岁,你还会考研吗?毕业后都奔三了!_计算机考研科目...
  19. DbVisualizer解决中文乱码问题
  20. Nginx软件介绍及下载地址

热门文章

  1. 这只“鸭子不一般”科大讯飞申请“躺倒鸭”商标
  2. POI读取Excel(兼容Excel2003、Excel2007)
  3. 用Kindle阅读PDF最简单的3个方法!
  4. 我看国内软件行业的发展方向
  5. kettle怎么复制资源库的job_kettle插件更新:定时执行资源库及文件的ktr和kjb作业...
  6. java工具类-java仿微信九宫格头像
  7. Silverlight实用窍门系列:29.Silverlight碰撞测试、检测自定义控件碰撞,雷达扫描图之扫描雷达点状态【附带源码实例】...
  8. uniswap合约解读和部署
  9. 你是怎样毁掉自己的?
  10. 月模拟题3 201609-3 炉石传说