zl程序教程

您现在的位置是:首页 >  其他

当前栏目

【IDEA插件开发】环境搭建

2023-04-18 16:42:39 时间

基础信息

GRADLE

7.5.1

IDEA

IntelliJ IDEA 2020.1.1 (Ultimate Edition)
Build #IU-201.7223.91, built on April 30, 2020
Licensed to https://zhile.io
You have a perpetual fallback license for this version
Subscription is active until July 8, 2089
Runtime version: 11.0.6+8-b765.40 amd64
VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o
Windows 10 10.0
GC: ParNew, ConcurrentMarkSweep
Memory: 1978M
Cores: 6
Non-Bundled Plugins: Lombook Plugin, org.intellij.gitee, com.piegoesmoo.escape, com.materkey.codepoints, MavenRunHelper, org.jetbrains.kotlin, cn.wuzhizhan.plugin.mybatis

配置gradle

  1. 配置环境变量, 如: GRADLE_HOME, PATH, GRADLE_USER_HOME

  2. 配置全局${GRADLE_USER_HOME}/init.gradle: https://blog.csdn.net/Young4Dream/article/details/98872523#comments_25589677

创建项目

在这里插入图片描述

配置

  1. 修改build.gradle

    plugins {
        id 'java'
        id 'org.jetbrains.intellij' version '1.13.2'
    }
    
    group 'org.example'
    version '1.0-SNAPSHOT'
    
    repositories {
        mavenCentral()
    }
    
    dependencies {
        testImplementation group: 'junit', name: 'junit', version: '4.12'
    }
    
    // See https://github.com/JetBrains/gradle-intellij-plugin/
    intellij {
        version='2020.1.1'
    }
    patchPluginXml {
        changeNotes = """
          Add change notes here.<br>
          <em>most HTML tags may be used</em>"""
    }
    
  2. 配置项目settings.gradle

    pluginManagement {
        repositories {
            maven {
                setUrl("https://maven.aliyun.com/repository/gradle-plugin")
            }
            maven {
                url 'https://oss.sonatype.org/content/repositories/snapshots/'
            }
            gradlePluginPortal()
            mavenCentral()
        }
    }
    rootProject.name = 'idea-plugin-example'
    

此时基本的插件开发环境就搭建好了, 此时项目结构如下:

在这里插入图片描述

参考

  1. IDEA2020.3.4开发插件创建项目报错