Giter Club home page Giter Club logo

jpublish's Introduction

在安卓组件化开发中,一般都有将自己写好的组件(aar)发布到公司私有Maven仓库的需求,一般采用maven-publish插件发布,这里我介绍一个插件帮助大家快速发布组件

效果预览

Kapture

使用

  • 在工程根目录build.gradle文件中添加jitpack仓库源及依赖
buildscript {
    repositories {
        ...
        maven { url 'https://jitpack.io' }
    }
  
    dependencies {
        ...
        classpath "com.github.Joehaivo:JPublish:1.0.0" 
    }
}
  • 在模块级别的build.gradle文件中添加以下代码,并根据当前模块填写aarInfo信息
apply plugin: "com.android.library"
...
apply plugin: 'com.github.joehaivo.jpublish'
task YourTaskName(dependsOn: 'jpublish') {
    aarInfo {
        groupId = 'com.xxx.xxx'
        artifactId = 'xxx'
        version = '0.1.1-SNAPSHOT'
        buildVariant = 'debug'
    }
}
  • 在工程根目录gradle.properties文件中添加:
MAVEN_SNAPSHOT_URL=http://Your-Private-Maven-Repository-Snapshot-Url
MAVEN_RELEASE_URL=http://Your-Private-Maven-Repository-Release-Url
  • 在工程根目录local.properties文件中添加账号信息(推荐),也可以填写在gradle.properties中(不推荐)
MAVEN_USERNAME=Your-Private-Maven-Repository-Username
MAVEN_PASSWORD=Your-Private-Maven-Repository-Password
  • 点击 task YourTaskName(dependsOn: 'jpublish') { 左侧的绿色三角▶️运行即可,发布成功会在Build Output窗口打印发布地址

字段及解释

字段 必选 类型 解释
YourTaskName Yes String 打包时的任务名,同一工程不可重名,可采取publish + ModuleName
groupId Yes String maven坐标的groupId
artifactId Yes String maven坐标的artifactId
version Yes String 正式发布时请去掉'-SNAPSHOT', 尽量遵循Gradle的版本号规则:x.y.z
buildVariant Yes String 打包类型, 可打开Android Studio中Build Variants窗口参考选择
mavenReleaseUrl No String 私有maven仓库(私服)release包的地址
mavenSnapshotUrl No String 私有maven仓库snapshot包的地址
mavenUsername No String 私有maven仓库的账号
mavenPassword No String 私有maven仓库的密码

项目地址

Github地址

JitPack发布地址

jpublish's People

Contributors

joehaivo avatar

Stargazers

 avatar nearby.ren avatar

Watchers

James Cloos avatar  avatar

Forkers

xinpolaris

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.