@@ -211,3 +211,69 @@ public class HelloAction extends AnAction {
211211我们开发 IDEA 插件主要是为了让 IDEA 更加好用,比如有些框架使用之后可以减少重复代码的编写、有些主题类型的插件可以让你的 IDEA 更好看。
212212
213213我这篇文章的这个案例说实话只是为了让大家简单入门一下 IDEA 开发,没有任何实际应用意义。** 如果你想要开发一个不错的 IDEA 插件的话,还要充分发挥想象,利用 IDEA 插件平台的能力。**
214+
215+ ## 常见问题一:JDK版本过低
216+
217+ 创建好项目之后,运行 Gradle,出现如下报错
218+
219+ ```
220+ FAILURE: Build failed with an exception.
221+
222+ * What went wrong:
223+ A problem occurred configuring root project 'string-template-error-scanner'.
224+ > Could not resolve all artifacts for configuration ':classpath'.
225+ > Could not resolve org.jetbrains.intellij.plugins:gradle-intellij-plugin:1.4.0.
226+ Required by:
227+ project : > org.jetbrains.intellij:org.jetbrains.intellij.gradle.plugin:1.4.0
228+ > Unable to find a matching variant of org.jetbrains.intellij.plugins:gradle-intellij-plugin:1.4.0:
229+ - Variant 'apiElements' capability org.jetbrains.intellij.plugins:gradle-intellij-plugin:1.4.0:
230+ - Incompatible attributes:
231+ - Required org.gradle.jvm.version '8' and found incompatible value '11'.
232+ - Required org.gradle.usage 'java-runtime' and found incompatible value 'java-api'.
233+ - Other attributes:
234+ - Found org.gradle.category 'library' but wasn't required.
235+ - Required org.gradle.dependency.bundling 'external' and found compatible value 'external'.
236+ - Found org.gradle.jvm.environment 'standard-jvm' but wasn't required.
237+ - Required org.gradle.libraryelements 'jar' and found compatible value 'jar'.
238+ - Found org.gradle.status 'release' but wasn't required.
239+ - Found org.jetbrains.kotlin.platform.type 'jvm' but wasn't required.
240+ - Variant 'runtimeElements' capability org.jetbrains.intellij.plugins:gradle-intellij-plugin:1.4.0:
241+ - Incompatible attribute:
242+ - Required org.gradle.jvm.version '8' and found incompatible value '11'.
243+ - Other attributes:
244+ - Found org.gradle.category 'library' but wasn't required.
245+ - Required org.gradle.dependency.bundling 'external' and found compatible value 'external'.
246+ - Found org.gradle.jvm.environment 'standard-jvm' but wasn't required.
247+ - Required org.gradle.libraryelements 'jar' and found compatible value 'jar'.
248+ - Found org.gradle.status 'release' but wasn't required.
249+ - Required org.gradle.usage 'java-runtime' and found compatible value 'java-runtime'.
250+ - Found org.jetbrains.kotlin.platform.type 'jvm' but wasn't required.
251+
252+ * Try:
253+ Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
254+
255+ * Get more help at https://help.gradle.org
256+
257+ BUILD FAILED in 94ms
258+ ```
259+
260+ > 原因分析:一般情况下,我们都是使用 JDK8 进行开发,但是新版的 IDEA 插件的编译需要使用 JAVA11 版本以上,因此要把 JDK8 换成 JDK11。(设置方法:左上角点击 Settings -> Build, Execution, Deployment, Build Tools -> Gradle,在下面找到 Gradle JVM: 改成 Java11 再次运行 Gradle 即可)
261+ >
262+ >
263+
264+ ## 常见问题二:无法创建 org.jetbrains.intellij.utils.ArchiveUtils 的实例
265+
266+ ```
267+ Build file 'D:\project\string-template-error-scanner\build.gradle' line: 3
268+
269+ An exception occurred applying plugin request [id: 'org.jetbrains.intellij', version: '1.4.0']
270+ > Failed to apply plugin [id 'org.jetbrains.intellij']
271+ > Could not create an instance of type org.jetbrains.intellij.utils.ArchiveUtils.
272+ > Could not generate a decorated class for type ArchiveUtils.
273+ > org/gradle/api/file/ArchiveOperations
274+
275+ ```
276+
277+ > 原因分析:这个问题我在 StackOverFlow、CSDN 等等网站搜了一大圈都从根源上找到怎么解决(知道的小伙伴可以编辑此页和我说一下~ )
278+ >
279+ > 最后通过修改 ` build.gradle ` 中 org.jetbrains.intellij 的版本解决的,我创建好项目之后版本是 1.4.0,换成 0.6.3,再重新运行一次 Gradle 就可以了
0 commit comments