这几天使用mvn install的时候, 使用以下的命令install成功了:
mvn install:install-file -Dfile=jar包位置 -DgroupId=jar包的groupId的ID -DartifactId=jar包的artifactId -Dversion=版本号 -Dpackaging=jar
1. 出现以下的问题:
每次安装都是到

每次安装都是C盘, 编译和打包都会报错, 接着看了一下warning信息, 它说55行有问题, 回去setting文件看下:
<repository>
<localRepository>E:\Repository</localRepository>
</repository>
发现多了一个标签repository, 什么时候弄得?不记得了, 后面改成以下:
<!-- 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>E:\Repository</localRepository>
注意: 上面的localRepository标签, 是一级标签, 我当时这个标签用了一个settings包起来, 所以每次mvn install jar的话都是安装到到默认的C盘去, 编译和打包都出现找不到jar包的问题改好,重新install:

成功了, 安装到E盘了
2. 编译的时候出现了任然去远程maven仓库拉取jar包, 结果报错:
Failure to find com.**:**-**-**:pom:1.0.6 in http://maven.aliyun.com/nexus/content/groups/public/ was cached in the local repository, resolution will not be reattempted until the update interval of alimaven has elapsed or updates are forced
后来发现本地jar包有个远程配置:

1) 第一种方法把它删除掉, 重新编译就ok了
2) 第二种: 编辑这个文件内容:

换成你的镜像id就ok
本文详细介绍了在使用Maven进行项目构建时遇到的安装路径错误与远程仓库依赖问题的解决方案。通过调整settings.xml文件中的localRepository标签,解决了安装路径问题,并提供了处理远程仓库依赖错误的方法。

1万+

被折叠的 条评论
为什么被折叠?



