Android Gradle 5+ Maven Publish Local(将本地文件发布到 Maven )
创始人
2024-08-14 00:30:15
0

要将本地文件发布到 Maven,可以使用Android Gradle插件的Maven Publish插件。下面是一个示例的解决方法。

首先,在你的项目的根目录的build.gradle文件中添加以下代码:

buildscript {
    repositories {
        google()
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:5.0.0'
        classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.8.4'
        classpath 'com.github.dcendents:android-maven-gradle-plugin:2.1'
    }
}

allprojects {
    repositories {
        google()
        jcenter()
    }
}

然后,在你要发布的module的build.gradle文件中添加以下代码:

apply plugin: 'com.android.library'
apply plugin: 'com.jfrog.bintray'
apply plugin: 'com.github.dcendents.android-maven'

android {
    // 配置你的Android构建设置
}

// 配置发布到Maven的设置
def siteUrl = 'https://github.com/your/repo'
def gitUrl = 'https://github.com/your/repo.git'

group = 'com.your.group'
version = '1.0.0'

install {
    repositories.mavenInstaller {
        pom {
            project {
                packaging 'aar'
                name 'Your Library Name'
                url siteUrl

                scm {
                    connection gitUrl
                    developerConnection gitUrl
                    url siteUrl
                }
            }
        }
    }
}

// 配置Bintray
bintray {
    user = 'your-username'
    key = 'your-api-key'
    configurations = ['archives']

    pkg {
        repo = 'maven'
        name = 'your-library-name'
        desc = 'Your library description'
        websiteUrl = siteUrl
        issueTrackerUrl = siteUrl + '/issues'
        vcsUrl = gitUrl
        licenses = ['Apache-2.0']

        publish = true
    }
}

接下来,在终端运行以下命令来发布到Maven:

./gradlew install
./gradlew bintrayUpload

完成后,你的本地文件将被发布到Maven仓库中。

请注意,你需要替换示例代码中的一些值,如你的项目URL、仓库URL、组名、版本号、用户名和API密钥等。

希望这个解决方法对你有帮助!

相关内容

热门资讯

第十分钟辅助!顺欣茶楼辅助软件... 第十分钟辅助!顺欣茶楼辅助软件,上品游戏辅助软件(一分钟了解开挂辅助工具);1、超多福利:超高返利,...
1分钟辅助!潮汕汇鱼虾蟹辅助,... 1分钟辅助!潮汕汇鱼虾蟹辅助,潮友潮汕木虱辅助(透视教程开挂辅助下载);潮友潮汕木虱辅助免费下载原版...
第9分钟辅助!蘑菇云辅助怎么使... 第9分钟辅助!蘑菇云辅助怎么使用,微信呢小程序微乐房间怎么开挂(我来分享开挂辅助工具);大家肯定在之...
第七分钟辅助!wepoker辅... 【福星临门,好运相随】;第七分钟辅助!wepoker辅助器是真的吗,闲逸斗地主辅助(透视app开挂辅...
八分钟辅助!智星菠萝可以辅助吗... 【福星临门,好运相随】;八分钟辅助!智星菠萝可以辅助吗,新道游开挂辅助透视(重大通报开挂辅助神器);...
辅助开挂!四川游戏家园辅助软件... 辅助开挂!四川游戏家园辅助软件,hhpkoer辅助器(透视)开挂辅助软件(有人有挂);1、不需要AI...
辅助开挂!博雅红河西元红河破解... 辅助开挂!博雅红河西元红河破解版,德州透视是真的吗(透视)开挂辅助平台(新版有挂);博雅红河西元红河...
开挂辅助!好友赣南新版本可以作... 开挂辅助!好友赣南新版本可以作假吗,hhpoker免费透视脚本(透视)开挂辅助神器(讲解有挂);小薇...
开挂辅助!微乐小程序辅助,德州... 开挂辅助!微乐小程序辅助,德州局hhpoker(透视)开挂辅助工具(有挂辅助);1、让任何用户在无需...
开挂辅助!雀友会潮汕麻将开挂辅... 开挂辅助!雀友会潮汕麻将开挂辅助,wepoker永久免费脚本(透视)开挂辅助软件(的确有挂);1、很...