[Android]发布码云(Gitee)项目到JitPack

339 阅读1分钟

发布安卓库到开源依赖JitPack

一、在安卓项目下的build.gradle添加classpath 'com.github.dcendents:android-maven-gradle-plugin:2.1'

buildscript {
    repositories {
        google()
        mavenCentral()
    }
    dependencies {
        classpath "com.android.tools.build:gradle:4.2.2"

        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files

        classpath 'com.github.dcendents:android-maven-gradle-plugin:2.1'
    }
}

二、在要发布的的模块下的build.gradle添加apply plugin: 'com.github.dcendents.android-maven'

apply plugin: 'com.github.dcendents.android-maven'

三、把项目提交到gitee并创建tag
注意:先把项目公开了

git push origin master
git tag 1.0.0
git push origin --tags

四、打开https://jitpack.io,把项目地址复制到jitpack,然后点击Look up
注意:先使用github账号登录

如果显示了要发布的版本,Log下面的图标和Status下的Git it绿色的,就代表成功发布了。

如果提示No credentials

gitee设置->私人令牌->创建->复制令牌
jitpackSetting->Gitee->粘贴令牌,等后面的三个点变成绿色勾勾,就表示验证成功了,后面在继续Look up就可以了。