专栏首页增长技术Gradle Plugin Publish

Gradle Plugin Publish


  1. 注册 https://plugins.gradle.org/user/register
  2. 登录后点击API Keys Tab 可以看到 gradle.publish.key=*** gradle.publish.secret=***
  3. 添加API Keys到你的gradle配置文件 gradle配置文件位置: $USER_HOME/.gradle/gradle.properties
  4. 使用 publishing plugin Simple Example: // First, apply the publishing plugin buildscript { repositories { maven { url "https://plugins.gradle.org/m2/" } } dependencies { classpath "com.gradle.publish:plugin-publish-plugin:0.9.6" } } apply plugin: "com.gradle.plugin-publish" // Apply other plugins here, e.g. java plugin for a plugin written in java or // the groovy plugin for a plugin written in groovy // If your plugin has any external java dependencies, Gradle will attempt to // downloaded them from JCenter for anyone using the plugins DSL // so you should probably use JCenter for dependency resolution in your own // project. repositories { jcenter() } dependencies { compile gradleApi() compile localGroovy() //not needed for Java plugins // other dependencies that your plugin requires } // Unless overridden in the pluginBundle config DSL, the project version will // be used as your plugin version when publishing version = "1.2" group = "com.foo.myplugin" // The configuration example below shows the minimum required properties // configured to publish your plugin to the plugin portal pluginBundle { website = 'http://www.gradle.org/' vcsUrl = 'https://github.com/gradle/gradle' description = 'Greetings from here!' tags = ['greetings', 'salutations'] plugins { greetingsPlugin { id = 'org.samples.greeting' displayName = 'Gradle Greeting plugin' } } } Full Example: // First, apply the publishing plugin buildscript { repositories { maven { url "https://plugins.gradle.org/m2/" } } dependencies { classpath "com.gradle.publish:plugin-publish-plugin:0.9.6" } } apply plugin: "com.gradle.plugin-publish" // Apply other plugins here, e.g. java plugin for a plugin written in java or // the groovy plugin for a plugin written in groovy // If your plugin has any external java dependencies, Gradle will attempt to // downloaded them from JCenter for anyone using the plugins DSL // so you should probably use JCenter for dependency resolution in your own // project. repositories { jcenter() } dependencies { compile gradleApi() compile localGroovy() //not needed for Java plugins // other dependencies that your plugin requires } pluginBundle { // These settings are set for the whole plugin bundle website = 'http://www.gradle.org/' vcsUrl = 'https://github.com/gradle/gradle' // tags and description can be set for the whole bundle here, but can also // be set / overridden in the config for specific plugins description = 'Greetings from here!' // The plugins block can contain multiple plugin entries. // // The name for each plugin block below (greetingsPlugin, goodbyePlugin) // does not affect the plugin configuration, but they need to be unique // for each plugin. // Plugin config blocks can set the id, displayName, version, description // and tags for each plugin. // id and displayName are mandatory. // If no version is set, the project version will be used. // If no tags or description are set, the tags or description from the // pluginBundle block will be used, but they must be set in one of the // two places. plugins { // first plugin greetingsPlugin { id = 'org.samples.greeting' displayName = 'Gradle Greeting plugin' tags = ['individual', 'tags', 'per', 'plugin'] version = '1.2' } // another plugin goodbyePlugin { id = 'org.samples.goodbye' displayName = 'Gradle Goodbye plugin' description = 'Override description for this plugin' tags = ['different', 'for', 'this', 'one'] version = '1.3' } } // Optional overrides for Maven coordinates. // If you have an existing plugin deployed to Bintray and would like to keep // your existing group ID and artifact ID for continuity, you can specify // them here. // // As publishing to a custom group requires manual approval by the Gradle // team for security reasons, we recommend not overriding the group ID unless // you have an existing group ID that you wish to keep. If not overridden, // plugins will be published automatically without a manual approval process. // // You can also override the version of the deployed artifact here, though it // defaults to the project version, which would normally be sufficient. mavenCoordinates { groupId = "org.samples.override" artifactId = "greeting-plugins" version = "1.4" } }
  5. 通过审核后,会收到邮件通知,就可以在https://plugins.gradle.org这里搜索到你的插件了^……^。

本文参与腾讯云自媒体分享计划,欢迎正在阅读的你也加入,一起分享。

我来说两句

0 条评论
登录 后参与评论

相关文章

  • ConcurrentModificationException

    用户3004328
  • App Intro相关

    ##How to use Add this to your build.gradle:

    用户3004328
  • Maven部署Web项目到Tomcat的配置

    Maven自动部署实际上调的是Tomcat安装目录下的manager功能。而为了能正常访问http://localhost:8080/manager页面,我们需...

    用户3004328
  • Android 黑科技 |Gradle Plugin使用场景

    一直想写一些关于安卓plugin的应用场景。只要想法够胆子大,这个能做很多你意想不到的优化点。

    逮虾户
  • 解决:打包SpringBoot项目成jar包后,其他的项目无法引入jar包中的对象

    TrueDei
  • 【刘文彬】区块链3.0:拥抱EOS

    原文链接:醒者呆的博客园,https://www.cnblogs.com/Evsward/p/eos-intro.html

    圆方圆学院
  • 区块链3.0:拥抱EOS

    EOS是当下最火的区块链技术,被社会广泛看好为下一代区块链3.0。不同于以太坊的学习,EOS的主语言是C++,本文作为EOS研究的首篇文章,重点介绍EOS的创...

    文彬
  • [Maven][l10n-maven-plugin]告警[WARNING] No dictionary file under folder

    执行mvn clean package site时报错[WARNING] No dictionary file under folder,详细报错如下:

    用户1221057
  • iOS原生地图开发指南 原

    在上一篇博客中:http://my.oschina.net/u/2340880/blog/414760。对iOS中的定位服务进行了详细的介绍与参数说明,在开发中...

    珲少
  • 最优秀的开源库之GPUImage

    近期想了解一下 IOS 下是如何进行音视频采集和渲染的。在学习一门新的知识时,很多人都有自己的学习方法,有的是买书学习,有的是看论坛等等不一而终。我的学习习惯是...

    音视频_李超

扫码关注云+社区

领取腾讯云代金券