前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >Gradle Plugin Publish

Gradle Plugin Publish

作者头像
用户3004328
发布2018-09-06 17:16:24
1.3K0
发布2018-09-06 17:16:24
举报
文章被收录于专栏:增长技术

  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这里搜索到你的插件了^……^。
本文参与 腾讯云自媒体同步曝光计划,分享自作者个人站点/博客。
原始发表:2016-10-10,如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 作者个人站点/博客 前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体同步曝光计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档