> 文章列表 > IDEA重复下载SNAPSHOT包问题

IDEA重复下载SNAPSHOT包问题

IDEA重复下载SNAPSHOT包问题

问题现象

reimport 之后 状态栏显示resolving dependencies…
遇到某个比较大的快照包(33M),同一天的第2个版本时 1.0-xxx-SNAPSHOT.时间戳-2
idea importer 会先分片下载 x.jar.part文件中,然后复制为x.jar吧
如图中所示,其实已经下载完了,但是它又一直重复下载到x.jar.part中
loop(n times) {resolving; indexing;}
最后达到一定次数之后,它就结束操作了,但是x.jar会被清空,0KB,因为它一直重复下载最后没下载完嘛
IDEA重复下载SNAPSHOT包问题

解决方案

停用idea导包

ps -ef | grep org.jetbrains.idea.maven.server.RemoteMavenServer36
kill -9 这个进程

这个类RemoteMavenServer36 在idea的 社区版源码中有具体代码和实现逻辑,有空可以看看具体实现是不是哪里有问题,从项目依赖中看并没有出来什么循环依赖之类的问题
https://github.com/JetBrains/intellij-community/blob/master/plugins/maven/maven36-server-impl/src/org/jetbrains/idea/maven/server/RemoteMavenServer36.java

然后自己导入这个包
Maven命令之–mvn install:install-file_Himmaa的博客-CSDN博客
https://blog.csdn.net/DaiH09/article/details/110086415

# 比较适合release版本
mvn install:install-file -DgroupId=com.abc -DartifactId=mavenTest -Dversion=1.0.0 -Dpackaging=jar -Dfile=C:\\myfile\\test.jar

建议用这个方式
亲测snapshot版也能用,不用提前下载包,它会直接从远程私库上下载到本地私库中,这种方式不走x.jar.part那种分片下载的方式

mvn org.apache.maven.plugins:maven-dependency-plugin:2.1:get -Dartifact=robo-guice:robo-guice:0.4-SNAPSHOT -DrepoUrl=http://download.java.net/maven/2/

参考

maven 2 - A simple command line to download a remote maven2 artifact to the local repository? - Stack Overflow
https://stackoverflow.com/questions/1776496/a-simple-command-line-to-download-a-remote-maven2-artifact-to-the-local-reposito