Maven配置教程

2. 修改maven默认的JDK版本

在<profiles>标签下添加一个<profile>标签,修改maven默认的JDK版本。

JDK-1.8

true

1.8

<maven.compiler.source>1.8</maven.compiler.source>

<maven.compiler.target>1.8</maven.compiler.target>

<maven.compiler.compilerVersion>1.8</maven.compiler.compilerVersion>

3. 添加国内镜像源

添加<mirrors>标签下<mirror>,添加国内镜像源,这样下载jar包速度很快。默认的中央仓库有时候甚至连接不通。一般使用阿里云镜像库即可。这里我就都加上了,Maven会默认从这几个开始下载,没有的话就会去中央仓库了。

<!-- 阿里云仓库 -->

<mirror>

<id>alimaven</id>

<mirrorOf>central</mirrorOf>

<name>aliyun maven</name>

<url>http://maven.aliyun.com/nexus/content/repositories/central/</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>

常用IDE下配置Maven


目前常用的开发工具如idea,eclipse都自身集成了一个版本的Maven。但是通常我们使用自己已经配置好的Maven。

IDEA下配置Maven

1:此处修改为自己解压的Maven目录

2:勾选Override,修改为自己目录下的settings.xml目录

3:修改为自己的本地仓库地址,一般会自动识别。

此处勾选,当修改pom文件时,Maven就能帮我们自动导包了。

Eclipse下配置Maven

  1. 将eclipse使用的Maven修改为自己的。点击add后选择自己Maven的安装目录即可。添加好之后记得勾选。

  1. 将所有的settings修改为自己Maven目录下的conf/settings.xml.点击Update Settings按钮,下面的Local Respository会自动识别出来。


附:完整的Settings.xml文件


<?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>D:\tools\repository</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>



<!-- 中央仓库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



### 最后

即使是面试跳槽,那也是一个学习的过程。只有全面的复习,才能让我们更好的充实自己,武装自己,为自己的面试之路不再坎坷!**今天就给大家分享一个Github上全面的Java面试题大全,就是这份面试大全助我拿下大厂Offer,月薪提至30K!**

**我也是第一时间分享出来给大家,希望可以帮助大家都能去往自己心仪的大厂!为金三银四做准备!**
一共有20个知识点专题,分别是:

#### Dubbo面试专题
![](https://img-blog.csdnimg.cn/img_convert/21d0c888793a6afb5a9b5c0134528fb5.webp?x-oss-process=image/format,png)

**JVM面试专题**

![这个GItHub上的Java项目开源了,2020最全的Java架构面试复习指南](https://img-blog.csdnimg.cn/img_convert/8b9a81eb1f10554e20ecd7be285353ec.webp?x-oss-process=image/format,png)

**Java并发面试专题**

![这个GItHub上的Java项目开源了,2020最全的Java架构面试复习指南](https://img-blog.csdnimg.cn/img_convert/497cfeabe61ba3b8c7e49133da12ac64.webp?x-oss-process=image/format,png)

**Kafka面试专题**

![这个GItHub上的Java项目开源了,2020最全的Java架构面试复习指南](https://img-blog.csdnimg.cn/img_convert/d7461e2cb3958874c8941f8b3eba8661.webp?x-oss-process=image/format,png)

**MongDB面试专题**

![这个GItHub上的Java项目开源了,2020最全的Java架构面试复习指南](https://img-blog.csdnimg.cn/img_convert/76d8e657698f6f362da71ca85639334d.webp?x-oss-process=image/format,png)

**MyBatis面试专题**

![这个GItHub上的Java项目开源了,2020最全的Java架构面试复习指南](https://img-blog.csdnimg.cn/img_convert/469aac71362d9def8054afb92b802841.webp?x-oss-process=image/format,png)

**MySQL面试专题**

![这个GItHub上的Java项目开源了,2020最全的Java架构面试复习指南](https://img-blog.csdnimg.cn/img_convert/acd21bfe1efa20e99e73985776bd9948.webp?x-oss-process=image/format,png)

**Netty面试专题**

![这个GItHub上的Java项目开源了,2020最全的Java架构面试复习指南](https://img-blog.csdnimg.cn/img_convert/fade1fd319beb782e7e71dc45bf1c7b0.webp?x-oss-process=image/format,png)

**RabbitMQ面试专题**

![这个GItHub上的Java项目开源了,2020最全的Java架构面试复习指南](https://img-blog.csdnimg.cn/img_convert/64332d58cf02133f8c04af8d7517aac5.webp?x-oss-process=image/format,png)

**Redis面试专题**

![这个GItHub上的Java项目开源了,2020最全的Java架构面试复习指南](https://img-blog.csdnimg.cn/img_convert/818839c387a27ea32f08c8a5468c624b.webp?x-oss-process=image/format,png)

**Spring Cloud面试专题**

![这个GItHub上的Java项目开源了,2020最全的Java架构面试复习指南](https://img-blog.csdnimg.cn/img_convert/7d8985e26b02379df19139409234da36.webp?x-oss-process=image/format,png)

**SpringBoot面试专题**

![这个GItHub上的Java项目开源了,2020最全的Java架构面试复习指南](https://img-blog.csdnimg.cn/img_convert/051fb5d83da3043dede6f4486f8f5c86.webp?x-oss-process=image/format,png)

**zookeeper面试专题**

![这个GItHub上的Java项目开源了,2020最全的Java架构面试复习指南](https://img-blog.csdnimg.cn/img_convert/4ea3646f4b385bec49352ab2e8921ad5.webp?x-oss-process=image/format,png)

**常见面试算法题汇总专题**

![这个GItHub上的Java项目开源了,2020最全的Java架构面试复习指南](https://img-blog.csdnimg.cn/img_convert/f200f6d88e5f94d36525fa4048820d2f.webp?x-oss-process=image/format,png)

**计算机网络基础专题**

![这个GItHub上的Java项目开源了,2020最全的Java架构面试复习指南](https://img-blog.csdnimg.cn/img_convert/c5639cb7c0b16b991c9a2463dc382dde.webp?x-oss-process=image/format,png)

**设计模式专题**

![这个GItHub上的Java项目开源了,2020最全的Java架构面试复习指南](https://img-blog.csdnimg.cn/img_convert/12a49d40b3469851229085dba19460c8.webp?x-oss-process=image/format,png)


**MySQL面试专题**

[外链图片转存中...(img-bga39gDC-1714417851143)]

**Netty面试专题**

[外链图片转存中...(img-mxk37eRp-1714417851144)]

**RabbitMQ面试专题**

[外链图片转存中...(img-KfNSaZzR-1714417851144)]

**Redis面试专题**

[外链图片转存中...(img-f1seVzbC-1714417851145)]

**Spring Cloud面试专题**

[外链图片转存中...(img-On5eLZBR-1714417851145)]

**SpringBoot面试专题**

[外链图片转存中...(img-9doaabSC-1714417851145)]

**zookeeper面试专题**

[外链图片转存中...(img-VEOAoLds-1714417851146)]

**常见面试算法题汇总专题**

[外链图片转存中...(img-zM6fpldf-1714417851146)]

**计算机网络基础专题**

[外链图片转存中...(img-lEp865Ve-1714417851146)]

**设计模式专题**

[外链图片转存中...(img-7CrVvz2M-1714417851147)]


> **本文已被[CODING开源项目:【一线大厂Java面试题解析+核心总结学习笔记+最新讲解视频+实战项目源码】](https://bbs.csdn.net/topics/618154847)收录**
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值