安装Maven

序言

本文仅介绍一些maven的安装和一些常用命令以及配置。

maven常用命令

mvn clean 清除缓存、target目录
mvn install

Maven的下载

官网下载
单机如图所示的压缩包进行下载
单机如图所示的压缩包进行下载

Maven的安装

将下载的压缩包解压到一个纯英文的目录下,例如
C:\soft
在这里插入图片描述
后文中将一直使用这个路径进行举例

解压后配置环境变量,为path添加 C:\soft\apache-maven-3.8.5\bin在这里插入图片描述

在这里插入图片描述

IDEA使用安装的Maven

在这里插入图片描述
修改IDEA“构建工具”中的“Maven”,按如图所示的路径进行配置。

tip:如果C盘非固态硬盘或更高效的硬盘不建议放在C盘,会影响系统运行效率。maven所在的盘需要预留一定空间下载jar包

部署项目到阿里云maven仓库

进入阿里云Maven仓库
在这里插入图片描述
选择“生产库-release”
在这里插入图片描述
选择推送覆盖方式后按指南操作即可

安装过程中遇到的错误

错误1

在这里插入图片描述

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-deploy-plugin:2.7:deploy (default-deploy) on project *: Failed to deploy artifacts: Could not transfer artifact *:jar:1.3.0-RELEASES from/to rdc-releases (https://packages.aliyun.com/maven/repository/*/): authentication failed for https://packages.aliyun.com/maven/repository/*-1.3.0-RELEASES.jar, status: 401 Unauthorized -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException

形成错误的原因

云效制品仓库,maven仓库管理员没有赋予上传权限

解决方案

自己创建一个maven仓库或给管理员要个开发或管理员权限

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值