存在*.lastUpdated文件也能更新jar文件的方法

正常情况下,我们是把仓库地址配置在settings.xml文件中的mirror节点下,这时如果生成了.lastUpdated文件,默认Maven是不会去取最新资源,但是如果我们把仓库资源配置在settings.xml的<profile>节点中,而不是mirror节点,那么即使更新失败,下一次同步也会忽略这些文件

<profile>配置如下:

[html]  view plain  copy
  1. <profiles>  
  2.   <profile>  
  3.     <id>dev<id> <!-- 这个id要和activeProfile里的id一样 -->  
  4.     <repositories>  
  5.       <repository>  
  6.         <id>Nexus</id>  
  7.         <url>http://192.168.9.91:8084/nexus/content/groups/futuresoftware</url>  
  8.         <releases>  
  9.          <enabled>true</enabled>  
  10.         </releases>  
  11.         <snapshots>  
  12.          <enabled>true</enabled>  
  13.         </snapshots>  
  14.       </repository>  
  15.     </repositories>  
  16.   </profile>  
  17. </profiles>  
  18. <activeProfiles>   
  19.   <activeProfile>dev</activeProfile>  
  20. </activeProfiles>  

针对PC与Maven私服之间网络传输问题 
1. 打开本地仓库所在目录, 通过win文件夹的搜索功能,查找 *.lastUpdated ,然后将找到的文件全部删除 
2. 重新 Maven Update Project, 
1. 若在eclipse中操作时勾选上 Force Update of Snapshots / Releases 
2. 若在命令行操作时增加 -U 参数 
一般情况下上面方法即可解决问题. 若问题依然存在,请确认下主机与Maven私服之间网络是否畅通.可以通过在浏览器中打开私服地址确认. 
若本机与私服之前网络畅通,那这个问题可能是由于私服与中央仓库(或者其他第三方仓库)之间下载依赖时网络故障导致的. 
针对私服与中央仓库或第三方仓库之间网络传输问题 
1. 使用管理员登陆私服页面(Sonatype Nexus) 
2. 在仓库的浏览页面找到下载失败的包, 右键菜单 “Update Index”, 右键菜单 “Expire Cache” 
3. 按照PC与私服之间网络问题的解决步骤处理一遍

问题描述:在Eclicpes中用SVN下载项目的是出现pom.xml文件错误

CoreException: Could not calculate build plan: Plugin org.apache.maven.plugin....
       
       
  • 1

再三的确认maven配置环境是正常的,本地创建仓库指向的路径也是正常的,那这是怎么鬼? 
解决步骤: 
首先要确定的是编辑环境中maven已经配置,在Eclipse中已经配置成功;并确保一下路径存在:

D:\apache-maven-3.2.5\conf\settings.xml
       
       
  • 1

确认两个地方的配置文件: 
1、pom.xml文件中,下面的配置是否正常,特别注意端口和下载地址是否能正常访问。

<repositories>    
        <repository>    
            <snapshots>    
                <enabled>true</enabled>    
            </snapshots> 
            <id>public</id>    
            <name>Public Repositories</name>    
            <url>http://xx.xx.xx.xx:xxxx/nexus/content/groups/public</url>   
        </repository>    
    </repositories> 
       
       
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10

2、pom.xml文件中,plugins是否配置

<plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>2.3.2</version>
                <configuration>
                    <source>1.6</source>
                    <target>1.6</target>
                </configuration>
            </plugin>
       
       
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10

3、在setting.xml配置文件中mirror配置文件是否和pom.xml中的1的代码一致;

<mirror>
      <id>nexus</id>
      <mirrorOf>central</mirrorOf>
      <name>Public Repositories</name>
      <url>http://xxx.xxx.xxx.xx:xxxx/nexus/content/groups/public</url>
    </mirror>
  </mirrors>
       
       
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值