maven 从仓库获取包报错处理

问题1:更新某个jar包都是LastUpdate,出现这种问题有如下可能

   可能1:没有权限,在settings.xml中设置本地仓库的密码登录账号和密码

<server>
   <id>snapshots</id>
   <username>admin</username>
   <password>admin</password>
</server>

  可能2:网络原因如果网络很差也可能出现等待超时

  可能3:包的版本包含了后缀比如<version>1.0.0.Snapshot</version> ,将版本号改成<version>1.0.0</version>

问题2:更新某个jar包后,本地仓库已经有此jar包,但是启动服务时始终报找不到jar包

  解决方法:里面包含了后缀为LastUpdate的文件,删除即可启动

问题3:nexus配置问题,可利用网页下载功能测试

  解决方法:浏览器访问http://maven.abc.com/nexus/content/repositories/central/....../abc.jar,如果无法被下载说明访问配置出错,

                 不过一般来说可能性不高,部署的时候应该已经测试通过

最后说一下:如果获取jar包时里面有LastUpdate后缀的文件,可以打开此文件,确保maven拉取jar包时从你配置好的路径拉取,如果压根都没去指定的远程路径获取,其他的都是空谈

                  这里提供一份简单的配置文件供参考

<?xml version="1.0" encoding="UTF-8"?>

  <!-- 本地存放路径 -->
  <localRepository>/Users/wb_james/.m2/repository</localRepository>

  <servers>
    <server>
        <id>releases</id>
        <username>admin</username>
        <password>aidingmao_521</password>
    </server>
    <server>
        <id>snapshots</id>
        <username>admin</username>
        <password>aidingmao_521</password>
    </server>
  </servers>

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

  </mirrors>

  

   <!-- 执行:$ mvn release:prepare 命令时会打包并发布到该仓库。 -->
     <profile>
       <id>nexus</id>
       <repositories>
         <repository>
           <id>nexus</id>
           <name>local private nexus</name>
           <url>http://maven.zugeliang01.com/nexus/content/groups/public</url>
         </repository>
        </repositories>
     </profile>

    <profile>
       <id>thirdparty</id>
       <repositories>
         <repository>
           <id>thirdparty</id>
           <name>3rd party</name>
           <url>http://maven.zugeliang01.com/nexus/content/repositories/thirdparty</url>
         </repository>
       </repositories>
    </profile>
    <profile>
      <id>jdk1.8</id>
      <activation>
          <activeByDefault>true</activeByDefault>
          <jdk>1.8</jdk>
      </activation>
      <properties>
          <maven.compiler.source>1.8</maven.compiler.source>
          <maven.compiler.target>1.8</maven.compiler.target>
          <maven.compiler.compilerVersion>1.8</maven.compiler.compilerVersion>
      </properties>
    </profile>
  </profiles>


  <!-- 这一步很重要,这里是配置启用的profile 可以看上面的profile标签 -->
  <activeProfiles>
    <activeProfile>nexus</activeProfile>
    <activeProfile>thirdparty</activeProfile>
  </activeProfiles>
</settings>

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值