作为代码的搬运工~多阅读,学思考,多尝试,应该多输出,多总结。
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