zoukankan      html  css  js  c++  java
  • maven本地库更新失败

    当我们在项目中遇到有些依赖在第三方仓库特别是maven仓库里面没有的时候我们会怎么办?

    答案1.通过私服,上传到公司的一个私服上然后进行下载

    答案2.通过本地安装,这样非常方面进行使用,今天我们就采用本地安装的方法。

    1.假设我们需要一个jframe.jar 的一个包在我们项目中要用到http服务发送,我们的做法如下:

    1. 使用本地库安装命令maven本地库
    mvn install:install-file -Dfile={Path/to/your/jframe.jar} -DgroupId=jframe -DartifactId=jframe -Dversion=1.5 -Dpackaging=jar
    

      2.出现安装成功以后就是在项目中引用了直接贴代码

       <dependency>
                <groupId>jframe</groupId>
                <artifactId>jframe</artifactId>
                <version>${jframe.version}</version>
         </dependency>
    

      3. 使用编译命令

    mvn clean install -DskipTests
    

      出现编译成功

    [INFO] --- maven-install-plugin:2.5.2:install (default-install) @ TopicInterface ---
    [INFO] Installing /home/joqk/Workspace/TopicInterface/target/TopicInterface-0.0.1.2017220-alpha.jar to /root/.m2/repository/com/thinkit/TopicInterface/0.0.1.2017220-alpha/TopicInterface-0.0.1.2017220-alpha.jar
    [INFO] Installing /home/joqk/Workspace/TopicInterface/pom.xml to /root/.m2/repository/com/thinkit/TopicInterface/0.0.1.2017220-alpha/TopicInterface-0.0.1.2017220-alpha.pom
    [INFO] ------------------------------------------------------------------------
    [INFO] BUILD SUCCESS
    [INFO] ------------------------------------------------------------------------
    [INFO] Total time: 3.088 s
    [INFO] Finished at: 2017-04-05T19:23:59+08:00
    [INFO] Final Memory: 47M/1567M
    

    其他问题:  

    1。更新的时候往往出现本地库的无法更新

    一般错误信息如下:

    was cached in the local repository ,resolution will will not be reattempted until the update interval of central has elapsed or updates are forced
    

      报错信息是在缓存在本地的本地库不会更新了,直到下次更新周期,即使我们进行手动更新命令也无效,就是这种错误,一直在进行。

    我们进入本地库找到该库文件一看究竟:

    [root@localhost 1.5]# pwd  /root/.m2/repository/jframe/jframe/1.5
    
    [root@localhost 1.5]# ls
    jframe-1.5.jar  jframe-1.5.jar.lastUpdated  jframe-1.5.jar.sha1  jframe-1.5.pom  jframe-1.5.pom.lastUpdated  jframe-1.5.pom.sha1  _remote.repositories
    

      会看到该库文件中有许多后缀名为.lastUpdated的文件,打看看一下内容表示在远程服务器中更新有错误,所以就留下了个这个文件。那我们的解决方案是什么呢?

    删除所有这些文件,再次执行 clean install 问题就迎刃而解了。

    最主要

  • 相关阅读:
    EzHttp 流传输调用代码示例
    使用EzHttp框架 开发基于HTTP协议的CS轻应用
    [转]Installing Memcached on Windows
    SQLiteServer+SQLiteClient 用于.Net项目的SQLite服务端程序和客户端类库
    ERROR: Pillow-5.2.0-cp35-cp35m-win_amd64.whl is not a supported wheel on this platform.
    Linux下的tar压缩解压缩命令详解
    scp 基于 SSH 的安全远程服务器文件拷贝
    大批量删除列表中元素的方法,自己用本办法做的
    Python 列表 pop() 方法
    可遍历的数据对象enumerate() 方法的使用
  • 原文地址:https://www.cnblogs.com/joqk/p/6670248.html
Copyright © 2011-2022 走看看