git登录账号token令牌生成
7d3d020df1131620a8e26d7055880920.png
1、maven的setting.xml文件加入以下配置


  <server>
        <id>github</id>
        <username>你的登录账号</username>
        <password>github的tokne</password>
    </server>

2、在你需要发布的程序的pom文件中加入

   <distributionManagement>
        <repository>
            <id>github</id>
            <name>GitHub fightinggg Apache Maven Packages</name>
            <url>https://maven.pkg.github.com/你的github用户名(不是登录账号)/github的空仓库</url>
        </repository>
    </distributionManagement>

3、mvn clean & mvn deploy即可
4、使用,你需要使用的项目中加入以下代码

    <repositories>
        <!--仓库地址-->
        <repository>
            <id>github</id>
            <name>GitHub OWNER Apache Maven Packages</name>
            <url>https://maven.pkg.github.com/你的github用户名(不是登录账号)/github的空仓库</url>
        </repository>
    </repositories>

注意点:
1、发布的maven中的artifactId不能有大写,可以用横线代替
错误:

 <dependency>
            <groupId>cn.zflzqy</groupId>
            <artifactId>**webSocket**</artifactId>
            <version>0.0.1</version>
        </dependency>

正确:

 <dependency>
            <groupId>cn.zflzqy</groupId>
            <artifactId>**web-socket**</artifactId>
            <version>0.0.1</version>
        </dependency>

5、引用(使用)也应该用同一个setting.xml文件,因为是私有的,需要对应的账号和token,如果发布公共的不如走maven中央仓库
6、相同版本不能覆盖,只能换版本号