• git搭建个人仓库


    缘起

    之前看到使用用了github来做maven仓库的教程,但国内github的速度不给力,个人偏向于使用码云gitee平台,便使用码云搭建了一个maven仓库,记录了下搭建过程。
    简单来说,共有三步:
    1. deploy到本地目录
    2. 把本地目录提交到码云上
    3. 配置git地址为仓库地址

    配置local file maven仓库

    deploy到本地
    maven可以通过http, ftp, ssh等deploy到远程服务器,也可以deploy到本地文件系统里。
    例如把项目deploy到C:/gitFiles/maven/repository/目录下:
    <distributionManagement>
            <repository>
                <id>mutool-maven</id>
                <url>file:/Users/connie/code/pserson_space/maven/repository</url>
            </repository>
            <snapshotRepository>
                <id>mutool-maven-snapshots</id>
                <name>Snapshots repository</name>
                <url>file:/Users/connie/code/pserson_space/maven/repository</url>
            </snapshotRepository>
        </distributionManagement>

    注意:部署本地一定要加file前缀

     
    通过命令行则是:
    mvn deploy -DaltDeploymentRepository=xwintop-maven::default::file:C:gitFiles/maven/repository/
     
    推荐使用命令行来deploy,避免在项目里显式配置。
     

    把本地仓库提交到github上

    上面把项目deploy到本地目录C:/gitFiles/maven/repository/里,下面把这个目录提交到gitee上。
    在码云上新建一个项目maven,然后把C:/gitFiles/maven/下的文件都提交到码云上。
    1. cd C:gitFiles/maven
    2. git init
    3. git add repository/*
    4. git commit -m 'deploy xxx'
    5. git remote add origin git@gitee.com:xwintop/maven.git
    6. git push origin master
     
    最终效果可以参考我的个人仓库:
    gitee码云 maven仓库的使用
    因为码云使用了gitee.com/${user_account}/${project_name}/raw/${branch}这个域名用于raw文件下载。所以使用这个maven仓库,只要在pom.xml里增加:
    <repositories>
       <repository>
          <id>xwintop-maven</id>
          <url>https://gitee.com/xwintop/maven/raw/master/repository</url>
    </repository>
    </repositories>

    注意:提交上去的jar包仓库要开通git pages并发布 

    总结

    目前国内使用码云平台托管的项目比较多,速度快,功能强大,推荐大家使用,谢谢。

  • 相关阅读:
    无题
    晒新玩具
    PHP开发调试环境配置(基于wampserver+Eclipse for PHP Developers )
    Java
    [转]const 与 readonly知多少
    Watin 杂谈
    WCF
    [转]: 两分钟彻底让你明白Android Activity生命周期(图文)!
    【转】单链表逆序
    桥梁模式和适配器模式的区别
  • 原文地址:https://www.cnblogs.com/leskang/p/14785871.html
Copyright © 2020-2023  润新知