Administrator
发布于 2022-12-15 / 29 阅读
0
0

idea使用

1、Cannot download sources Sources not found for:XXX

在debug源码的时候,自己看到的源码可能和自己maven配置的版本不一样,打断点在上面也就停不下来了,看注释也没有,点击右上角的download sources又弹出以上错误的话:
右键该项目在控制台打开,执行以下命令:

mvn dependency:resolve -Dclassifier=sources

2023/2/16更

从github上拉项目下来,导入依赖的时候有问题,依赖整片爆红,但pom文件没爆红

image-1676531786520

拉取依赖时报错误信息

Cannot resolve Failure to transfer com.oracle:ojdbc6:pom:11.2.0.3 from http://repo1.maven.org/maven2/ was cached in the local repository, resolution will not be reattempted until the update interval of repo1 has elapsed or updates are forced. Original error: Could not transfer artifact com.oracle:ojdbc6:pom:11.2.0.3 from/to repo1 (http://repo1.maven.org/maven2/): Failed to transfer file http://repo1.maven.org/maven2/com/oracle/ojdbc6/11.2.0.3/ojdbc6-11.2.0.3.pom with status code 501



Cannot resolve Failure to transfer com.microsoft.sqlserver:sqljdbc4:pom:4.0 from http://repo1.maven.org/maven2/ was cached in the local repository, resolution will not be reattempted until the update interval of repo1 has elapsed or updates are forced. Original error: Could not transfer artifact com.microsoft.sqlserver:sqljdbc4:pom:4.0 from/to repo1 (http://repo1.maven.org/maven2/): Failed to transfer file http://repo1.maven.org/maven2/com/microsoft/sqlserver/sqljdbc4/4.0/sqljdbc4-4.0.pom with status code 501

当我把pom文件里的sqlserver,ojdbc6依赖注释后,再拉取就不会报错。但这样肯定是不行的,网上说这是不允许maven导包,要手动导包。但我觉得是镜像的问题,因为拉取不成功

我的镜像:

    <mirror>
      <id>alimaven</id>
      <mirrorOf>central</mirrorOf>
      <name>aliyun maven</name>
      <url>http://maven.aliyun.com/nexus/content/repositories/central/</url>
    </mirror>


    <mirror>
      <id>repo1</id>
      <mirrorOf>*</mirrorOf>
      <url>http://repo1.maven.org/maven2/</url>
      <!--         <mirrorOf>central</mirrorOf> -->
    </mirror>

好似没啥差别,但我换了网上别的镜像配置,即将repo1的mirrorOf标签值改为central后,问题就解决了,或者只留下阿里云的镜像

补充学习镜像配置信息:

<mirrorOf>central</mirrorOf> 
表示该配置为中央仓库的镜像,任何对于中央仓库的请求都会转至该镜像
 
<mirrorOf>*</mirrorOf> 
匹配所有仓库请求,即将所有的仓库请求都转到该镜像上
 
<mirrorOf>repo1,repo2</mirrorOf> 
将仓库repo1和repo2的请求转到该镜像上,使用逗号分隔多个远程仓库。 
 
<mirrorOf>*,!repo1</miiroOf> 
匹配所有仓库请求,repo1除外,使用感叹号将仓库从匹配中排除。

评论