Maven仓库无法下载依相关jar包 只能下载到lastUpdate文件

众所周知,Maven在下载仓库中找不到相应资源或者网速太慢时,会生成一个.lastUpdated为后缀的文件。如果这个文件存在,那么即使换一个有资源的仓库后,Maven依然不会去下载新资源。

以下是简单的解决方案:

  1. 你可以先把.lastupdate的后缀删掉试试能不能使用
  2. 你可以直接使用mvn命令下载maven依赖
  3. 使用阿里的仓库
<mirrors>
    <mirror>
        <id>alimaven</id>
        <name>aliyun maven</name>
        <url>http://maven.aliyun.com/nexus/content/groups/public/</url>
        <mirrorOf>central</mirrorOf>
    </mirror>
</mirrors>
  1. 修改Setting.xml配置文件

<profiles>
  <profile>
    <id>dev<id>	<!-- 这个id要和activeProfile里的id一样 -->
    <repositories>
      <repository>
        <id>Nexus</id>
        <url>http://192.168.9.91:8084/nexus/content/groups/futuresoftware</url>
        <releases>
         <enabled>true</enabled>
        </releases>
        <snapshots>
         <enabled>true</enabled>
        </snapshots>
      </repository>
    </repositories>
  </profile>
</profiles>
<activeProfiles> 
  <activeProfile>dev</activeProfile>
</activeProfiles>

猜你喜欢

转载自blog.csdn.net/Mr_FengMou/article/details/104392010