美文网首页
远程仓库拉取指定版本,编译jar包

远程仓库拉取指定版本,编译jar包

作者: JamFF | 来源:发表于2019-03-28 22:32 被阅读0次

    由于某些原因,我们不能依赖远程仓库,比如编译 library 提供 jar 包给第三方,第三方使用 Eclipse ,也不能依赖远程仓库,这中坑爹情况。

    这就需要我们下载源码,或者编译远程仓库生成 jar 放在 library 中引入。

    glide 为例,目前官网最新是 4.9.0 版本,如果要编译 4.8.0 版本的 jar,该如何操作呢。

    1. 首先clone项目到本地
      git clone https://github.com/bumptech/glide.git
    2. 然后进入项目
      cd glide/
    3. 查看历史版本
      git tag
    4. 拉取指定版本
      git checkout tags/1.2.1
    5. 编译 jar 包
      ./gradlew assemble
    FFdeMacBook-Pro:jar ff$ git clone https://github.com/bumptech/glide.git
    
    Cloning into 'glide'...
    remote: Enumerating objects: 70773, done.
    remote: Total 70773 (delta 0), reused 0 (delta 0), pack-reused 70773
    Receiving objects: 100% (70773/70773), 56.37 MiB | 297.00 KiB/s, done.
    Resolving deltas: 100% (45833/45833), done.
    
    FFdeMacBook-Pro:jar ff$ cd glide/
    FFdeMacBook-Pro:glide ff$ git tag
    
    v2.0-alpha
    v2.0.0
    v2.0.1
    v2.0.2
    v2.0.3
    v2.0.4
    v2.0.5
    v3.0.0a
    v3.1.0a
    v3.2.0a
    v3.3.0
    v3.3.1
    v3.4.0
    v3.5.0
    v3.5.1
    v3.5.2
    v3.6.0
    v3.6.1
    v3.7.0
    v3.8.0
    v4.0.0
    v4.0.0-RC0
    v4.0.0-RC1
    v4.1.0
    v4.1.1
    v4.2.0
    v4.3.0
    v4.3.1
    v4.4.0
    v4.5.0
    v4.6.0
    v4.6.1
    v4.7.0
    v4.7.1
    v4.8.0
    v4.9.0
    
    FFdeMacBook-Pro:glide ff$ git checkout tags/v4.8.0
    Note: checking out 'tags/v4.8.0'.
    
    You are in 'detached HEAD' state. You can look around, make experimental
    changes and commit them, and you can discard any commits you make in this
    state without impacting any branches by performing another checkout.
    
    If you want to create a new branch to retain commits you create, you may
    do so (now or later) by using -b with the checkout command again. Example:
    
      git checkout -b <new-branch-name>
    
    HEAD is now at 914996cac Bump version to 4.8.0
    
    FFdeMacBook-Pro:glide ff$ ./gradlew assemble
    
    ... 省略编译信息 ...
    BUILD SUCCESSFUL in 12m 43s
    439 actionable tasks: 439 executed
    
    FFdeMacBook-Pro:glide ff$ cd glide/build/libs/
    FFdeMacBook-Pro:libs ff$ ls
    glide-full-4.8.0-javadoc.jar    glide-full-4.8.0.jar
    glide-full-4.8.0-sources.jar
    FFdeMacBook-Pro:libs ff$ 
    

    上面的 glide-full-4.8.0.jar 就是我们需要的 jar 包。

    相关文章

      网友评论

          本文标题:远程仓库拉取指定版本,编译jar包

          本文链接:https://www.haomeiwen.com/subject/arpcbqtx.html