MAven 安装与配置

一、安装本地Maven

点此进入[maven](https://maven.apache.org/download.cgi)官网下载


选择左侧Download

在这里插入图片描述

下载完成后,选择一个路径进行解压

然后配置path环境变量,如图

在这里插入图片描述

在这里插入图片描述

path:

在这里插入图片描述

然后win+R 运行cmd 输入 mvn -version,如图所示则配置成功

在这里插入图片描述

二、配置settings文件

1、在F:\dev\apache-maven-3.6.1\conf下可以找到settings文件,打开(嫌麻烦的直接看最后一步)

2、 找到第52行,这里是maven默认的仓库
在这里插入图片描述

3、 我们复制第53行

/path/to/local/repo

将它拿到注释外并将中间的内容改成你需要的路径,

F:/repository

这里的路径随便设置,注意这里是正斜杠
在这里插入图片描述

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标签之间

在这里插入图片描述

6、 在最后配置jdk,也要夹在两个profiles标签之间

jdk-1.8 true 1.8
  <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>

在这里插入图片描述

7、 配置完成,在命令行输入mvn help:system测试,看到下载链接里面是ailiyun的链接表示配置成功

8、 嫌麻烦的直接复制配置文件的内容即可,不过路径还是要改(参考第3步)

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

F:/repository

<!-- 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>
-->
<!-- mirror
<mirrors>
 | 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>
 </mirrors>
 -->
 <!-- 阿里云仓库 -->
nexus-aliyun * Nexus aliyun http://maven.aliyun.com/nexus/content/groups/public jdk-1.8 true 1.8
  <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>

JDBC工具类的封装可以参考https://blog.csdn.net/Hellohupeng/article/details/107902561

  • 2
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值