了解一下:一款好用的 Maven Library 发布插件

GitHub: gradle-publish-plugin

Gradle Publish Plugin

A flex gradle plugin for publish your library to maven repository become easy.

Feature

  • support publish multi-library, such as Java、Android、Kotlin
  • support for api / implementation dependencies in new Gradle
  • supports also @aar and transitive: false.
  • generate Kotlin doc with dokka
  • support upload sources Jar (configurable, default true)
  • sign a library including sources, Javadoc, and a customized POM (configurable, default false, and require Gradle Version >= 4.8)

Usage

for Gradle version >= 2.1:

    plugins {
      id "com.whl.gradle-publish-plugin" version "0.1.16-SNAPSHOT"
    }
复制代码

for Gradle version < 2.1 or where dynamic configuration is required:

    buildscript {
      repositories {
        maven {
          url "https://plugins.gradle.org/m2/"
        }
      }
      dependencies {
        classpath "com.whl:gradle-publish-plugin:0.1.16-SNAPSHOT"
      }
    }

    apply plugin: "com.whl.gradle-publish-plugin"
复制代码

Also see it in Gradle plugins

"com.whl.gradle-publish-plugin" should be after apply "java-library" or "com.android.library"

then, configuration in your build.gradle,such as:

simple example:

    group 'com.example'
    version '1.0-SNAPSHOT'

    gradlePublish {

        releaseRepository {
            url = "http://your repository.com/nexus/content/repositories/releases"
            userName = "your release account"
            password = "your release account"
        }

    }
复制代码

complete example:

    group 'com.example'
    version '1.0-SNAPSHOT'

    gradlePublish {

        sourceJarEnabled = true
        javaDocEnabled = true
        signEnabled = false

        releaseRepository {
            url = "http://your repository.com/nexus/content/repositories/releases"
            userName = "your release account"
            password = "your release account"
        }

        snapshotRepository {
            url = "http://your repository.com/nexus/content/repositories/snapshots"
            userName = "your snapshot account"
            password = "your snapshot account"
        }

    }
复制代码

last, execute ./gradlew publish task to publish your library to specified maven repository

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值