Intellij IDEA 插件开发之自建插件仓库
来源:互联网 发布:java中的extends 编辑:程序博客网 时间:2024/04/28 07:59
Intellij IDEA 有一个自己的官方的插件仓库,但是当我们的开发的 Intellij IDEA 的插件不能够对外公开时,我们就需要搭建自己的 Intellij IDEA 的插件仓库。前不久我们也尝试着使用Intellij IDEA自己开发一个插件点击打开链接。
搭建 Intellij IDEA 插件仓库
Intellij IDEA 的官方文档里面有提到怎么去新建一个插件仓库,但是,这部分的文档却不在 Intellij IDEA 插件的开发文档里面,而是在插件相关功能的使用文档里面:https://www.jetbrains.com/help/idea/2016.3/adding-plugins-to-enterprise-repositories.html
这里简单对这个文档进行一个说明,如果需要新建一个插件仓库,非常简单,只需要提供一个 URL,当访问这个 URL 的时候,返回如下的一个 XML 即可:
<plugins> <plugin id="com.taobao.middleware.HotCode2Plugin" url="http://localhost/downloads/hotcode2-idea-plugin.jar" version="0.1"/> <plugin id="com.alipay.sofa.andromeda" url="http://localhost/idea/download/com.alipay.sofa.andromeda-1.1.34.zip" version="1.1.34"/></plugins>
注:id
为插件的 ID,需要跟在插件的plugin.xml
里面的设定的 ID 一致。url
为插件的 ZIP 包下载的地址。version
是插件的版本号。
使用 gradle 来构建 intellij IDEA插件
添加
Intellij Plugin
对 Gradle
的支持其实和 Android
差不多, 需要添加官方的插件支持.1,在你 Intellij plugin 项目的根目录里执行命令
gradle init
来初始化一个 gradle
工程。2,修改
build.gradle
文件,让它能够支持构建 intellij 插件。3,添加
intellij build plugins
仓库地址:https://plugins.gradle.org/plugin/org.jetbrains.intellij 官方推荐了两种添加方式, 这里我们采用第二种。plugins { id "org.jetbrains.intellij" version "0.1.10"}
4,使用 intellij idea 的插件(这和Android添加插件是一样的)
apply plugin: 'java'apply plugin: 'idea'apply plugin: 'org.jetbrains.intellij'
5,设置运行插件的 intellij 版本以及沙箱地址intellij { version = 'IU-163.7342.3' //调试我们插件的版本 sandboxDirectory = project.rootDir.canonicalPath + "/.sandbox" //插件生成的临时文件的地址}
完成以上操作, 我们需要用 Idea 来重新以 gradle 的工程来导入我们的项目,这样就可以支持 gradle 啦。
附上build.gradle的完整配置:
/* * This build file was auto generated by running the Gradle 'init' task * by 'darin' at '11/4/16 10:39 AM' with Gradle 2.12 * * This generated file contains a commented-out sample Java project to get you started. * For more details take a look at the Java Quickstart chapter in the Gradle * user guide available at https://docs.gradle.org/2.12/userguide/tutorial_java_projects.html */plugins { id 'org.jetbrains.intellij' version "0.1.10"}apply plugin: 'java'apply plugin: 'idea'apply plugin: 'org.jetbrains.intellij'// In this section you declare where to find the dependencies of your projectrepositories { // Use 'jcenter' for resolving your dependencies. // You can declare any Maven/Ivy/file repository here. jcenter() mavenCentral() maven { url "https://raw.github.com/embarkmobile/zxing-android-minimal/mvn-repo/maven-repository/" }}intellij { version = 'IU-163.7342.3' plugins = ['JavaScriptLanguage', 'CSS'] sandboxDirectory = project.rootDir.canonicalPath + "/.sandbox"}sourceSets { main.java.srcDirs = ['src', 'gen'] main.resources.srcDir 'resources' test.java.srcDir 'test/src' test.resources.srcDir 'test/data'}// In this section you declare the dependencies for your production and test codedependencies { compile fileTree(dir: 'lib', include: ['*.jar']) // The production code uses the SLF4J logging API at compile time compile 'org.slf4j:slf4j-api:1.7.18' // Declare the dependency for your favourite test framework you want to use in your tests. // TestNG is also supported by the Gradle Test task. Just change the // testCompile dependency to testCompile 'org.testng:testng:6.8.1' and add // 'test.useTestNG()' to your build script. testCompile 'junit:junit:4.12' compile 'com.google.zxing:core:3.2.1' compile 'com.google.zxing:javase:2.2'}
使用 Gradle 来快速发布插件到自建仓库
host
可以设置自定义的仓库,我们可以在自己的 build.gradle
文件里面设置这个 host
属性:publishPlugin.doFirst { publishPlugin.host = 'http://ysera.alipay.net:9000/' }
设置好了之后,就可以直接使用 gradle publishPlugin
来发布 Intellij IDEA 插件了。不过这里需要注意,我们上传的插件需要包含如下信息:userName
:用户名password
:密码xmlId
:插件的 ID,也就是在plugin.xml
里面定义的 ID。file
:插件的 ZIP 包。
所以到这里,我们自建的插件仓库就可以使用了。
1 1
- Intellij IDEA 插件开发之自建插件仓库
- Intellij IDEA插件开发入门
- Intellij Idea golang插件开发
- Intellij IDEA插件开发入门
- Intellij IDEA中Git插件提交内容到远程仓库
- intellij idea的插件开发小结
- IntelliJ IDEA 安装scala开发插件
- IntelliJ idea插件开发环境配置
- IntelliJ idea插件开发(一)
- intellij-idea-plugin-(插件开发资料)
- Intellij IDEA安装插件
- intellij idea ibatis插件
- IntelliJ IDEA插件结构
- IntelliJ Idea 常用插件
- intellij idea 插件备忘
- IntelliJ IDEA插件结构
- IntelliJ IDEA 插件收集
- intellij idea 插件推荐
- |洛谷|贪心|P1958 上学路线_NOI导刊2009普及(6)
- 【Javascript基础】null 和undefined
- 【玲珑学院OJ1063】Variance(线段树)
- 伯乐在线:一个让人受益的网站
- 编译第三方库时缺少libltdl.h库
- Intellij IDEA 插件开发之自建插件仓库
- js面向对象编程
- Spring基础:快速入门spring(8):bean scope
- IOS设置程序的入口
- 字符串排序
- |洛谷|分治|P2799 国王的魔镜
- ImageIO drawString 中文乱码问题
- windows7搭建基于VIM的开发环境(2)-编译64位且支持python的VIM版本并安装
- ImageNet 数据集