ClassNotFoundException: com.intellij.ant.InstrumentIdeaExtensions after set intellijRepository to custom repo
I am developing an IntelliJ IDEA plugin. After setting the intellijRepository
property to a custom repo address in Gradle, I encounter this error during the plugin build process. I do not understand how the change of the repo address has any relation to this error.
gralde version: 8.4
idea plugin(org.jetbrains.intellij) version : 1.16.1
my gralde config:
intellij {
val localVersion = System.getenv("idea.version")
val localPlatform = System.getenv("idea.platform")
version.set(localVersion ?: "2023.3.2")
type.set(localPlatform ?: "IU")
intellijRepository.set("https://my-repo")
}
ErrorInfo:
org.gradle.api.tasks.TaskExecutionException: Execution failed for task ':instrumentCode'.
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.lambda$executeIfValid$1(ExecuteActionsTaskExecuter.java:148)
at org.gradle.internal.Try$Failure.ifSuccessfulOrElse(Try.java:282)
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeIfValid(ExecuteActionsTaskExecuter.java:146)
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.execute(ExecuteActionsTaskExecuter.java:134)
at org.gradle.api.internal.tasks.execution.FinalizePropertiesTaskExecuter.execute(FinalizePropertiesTaskExecuter.java:46)
at org.gradle.api.internal.tasks.execution.ResolveTaskExecutionModeExecuter.execute(ResolveTaskExecutionModeExecuter.java:51)
at org.gradle.api.internal.tasks.execution.SkipTaskWithNoActionsExecuter.execute(SkipTaskWithNoActionsExecuter.java:57)
at org.gradle.api.internal.tasks.execution.SkipOnlyIfTaskExecuter.execute(SkipOnlyIfTaskExecuter.java:74)
at org.gradle.api.internal.tasks.execution.CatchExceptionTaskExecuter.execute(CatchExceptionTaskExecuter.java:36)
at org.gradle.api.internal.tasks.execution.EventFiringTaskExecuter$1.executeTask(EventFiringTaskExecuter.java:77)
at org.gradle.api.internal.tasks.execution.EventFiringTaskExecuter$1.call(EventFiringTaskExecuter.java:55)
at org.gradle.api.internal.tasks.execution.EventFiringTaskExecuter$1.call(EventFiringTaskExecuter.java:52)
at org.gradle.internal.operations.DefaultBuildOperationRunner$CallableBuildOperationWorker.execute(DefaultBuildOperationRunner.java:204)
at org.gradle.internal.operations.DefaultBuildOperationRunner$CallableBuildOperationWorker.execute(DefaultBuildOperationRunner.java:199)
at org.gradle.internal.operations.DefaultBuildOperationRunner$2.execute(DefaultBuildOperationRunner.java:66)
at org.gradle.internal.operations.DefaultBuildOperationRunner$2.execute(DefaultBuildOperationRunner.java:59)
at org.gradle.internal.operations.DefaultBuildOperationRunner.execute(DefaultBuildOperationRunner.java:157)
at org.gradle.internal.operations.DefaultBuildOperationRunner.execute(DefaultBuildOperationRunner.java:59)
at org.gradle.internal.operations.DefaultBuildOperationRunner.call(DefaultBuildOperationRunner.java:53)
at org.gradle.internal.operations.DefaultBuildOperationExecutor.call(DefaultBuildOperationExecutor.java:78)
at org.gradle.api.internal.tasks.execution.EventFiringTaskExecuter.execute(EventFiringTaskExecuter.java:52)
at org.gradle.execution.plan.LocalTaskNodeExecutor.execute(LocalTaskNodeExecutor.java:42)
at org.gradle.execution.taskgraph.DefaultTaskExecutionGraph$InvokeNodeExecutorsAction.execute(DefaultTaskExecutionGraph.java:331)
at org.gradle.execution.taskgraph.DefaultTaskExecutionGraph$InvokeNodeExecutorsAction.execute(DefaultTaskExecutionGraph.java:318)
at org.gradle.execution.taskgraph.DefaultTaskExecutionGraph$BuildOperationAwareExecutionAction.lambda$execute$0(DefaultTaskExecutionGraph.java:314)
at org.gradle.internal.operations.CurrentBuildOperationRef.with(CurrentBuildOperationRef.java:80)
at org.gradle.execution.taskgraph.DefaultTaskExecutionGraph$BuildOperationAwareExecutionAction.execute(DefaultTaskExecutionGraph.java:314)
at org.gradle.execution.taskgraph.DefaultTaskExecutionGraph$BuildOperationAwareExecutionAction.execute(DefaultTaskExecutionGraph.java:303)
at org.gradle.execution.plan.DefaultPlanExecutor$ExecutorWorker.execute(DefaultPlanExecutor.java:463)
at org.gradle.execution.plan.DefaultPlanExecutor$ExecutorWorker.run(DefaultPlanExecutor.java:380)
at org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.onExecute(ExecutorPolicy.java:64)
at org.gradle.internal.concurrent.AbstractManagedExecutor$1.run(AbstractManagedExecutor.java:47)
Caused by: : taskdef class com.intellij.ant.InstrumentIdeaExtensions cannot be found
using the classloader AntClassLoader[]
at org.apache.tools.ant.taskdefs.Definer.addDefinition(Definer.java:597)
at org.apache.tools.ant.taskdefs.Definer.execute(Definer.java:236)
at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:299)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:99)
at org.gradle.api.internal.project.ant.BasicAntBuilder.nodeCompleted(BasicAntBuilder.java:90)
at org.gradle.api.internal.project.ant.BasicAntBuilder.doInvokeMethod(BasicAntBuilder.java:117)
at org.jetbrains.intellij.tasks.InstrumentCodeTask.intelliJInstrumentCode(InstrumentCodeTask.kt:120)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at org.gradle.internal.reflect.JavaMethod.invoke(JavaMethod.java:125)
at org.gradle.api.internal.project.taskfactory.IncrementalTaskAction.doExecute(IncrementalTaskAction.java:45)
at org.gradle.api.internal.project.taskfactory.StandardTaskAction.execute(StandardTaskAction.java:51)
at org.gradle.api.internal.project.taskfactory.IncrementalTaskAction.execute(IncrementalTaskAction.java:26)
at org.gradle.api.internal.project.taskfactory.StandardTaskAction.execute(StandardTaskAction.java:29)
at org.gradle.api.internal.tasks.execution.TaskExecution$3.run(TaskExecution.java:248)
at org.gradle.internal.operations.DefaultBuildOperationRunner$1.execute(DefaultBuildOperationRunner.java:29)
at org.gradle.internal.operations.DefaultBuildOperationRunner$1.execute(DefaultBuildOperationRunner.java:26)
at org.gradle.internal.operations.DefaultBuildOperationRunner$2.execute(DefaultBuildOperationRunner.java:66)
at org.gradle.internal.operations.DefaultBuildOperationRunner$2.execute(DefaultBuildOperationRunner.java:59)
at org.gradle.internal.operations.DefaultBuildOperationRunner.execute(DefaultBuildOperationRunner.java:157)
at org.gradle.internal.operations.DefaultBuildOperationRunner.execute(DefaultBuildOperationRunner.java:59)
at org.gradle.internal.operations.DefaultBuildOperationRunner.run(DefaultBuildOperationRunner.java:47)
at org.gradle.internal.operations.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:73)
at org.gradle.api.internal.tasks.execution.TaskExecution.executeAction(TaskExecution.java:233)
at org.gradle.api.internal.tasks.execution.TaskExecution.executeActions(TaskExecution.java:216)
at org.gradle.api.internal.tasks.execution.TaskExecution.executeWithPreviousOutputFiles(TaskExecution.java:199)
at org.gradle.api.internal.tasks.execution.TaskExecution.execute(TaskExecution.java:166)
at org.gradle.internal.execution.steps.ExecuteStep.executeInternal(ExecuteStep.java:105)
at org.gradle.internal.execution.steps.ExecuteStep.access$000(ExecuteStep.java:44)
at org.gradle.internal.execution.steps.ExecuteStep$1.call(ExecuteStep.java:59)
at org.gradle.internal.execution.steps.ExecuteStep$1.call(ExecuteStep.java:56)
at org.gradle.internal.operations.DefaultBuildOperationRunner$CallableBuildOperationWorker.execute(DefaultBuildOperationRunner.java:204)
at org.gradle.internal.operations.DefaultBuildOperationRunner$CallableBuildOperationWorker.execute(DefaultBuildOperationRunner.java:199)
at org.gradle.internal.operations.DefaultBuildOperationRunner$2.execute(DefaultBuildOperationRunner.java:66)
at org.gradle.internal.operations.DefaultBuildOperationRunner$2.execute(DefaultBuildOperationRunner.java:59)
at org.gradle.internal.operations.DefaultBuildOperationRunner.execute(DefaultBuildOperationRunner.java:157)
at org.gradle.internal.operations.DefaultBuildOperationRunner.execute(DefaultBuildOperationRunner.java:59)
at org.gradle.internal.operations.DefaultBuildOperationRunner.call(DefaultBuildOperationRunner.java:53)
at org.gradle.internal.operations.DefaultBuildOperationExecutor.call(DefaultBuildOperationExecutor.java:78)
at org.gradle.internal.execution.steps.ExecuteStep.execute(ExecuteStep.java:56)
at org.gradle.internal.execution.steps.ExecuteStep.execute(ExecuteStep.java:44)
at org.gradle.internal.execution.steps.RemovePreviousOutputsStep.execute(RemovePreviousOutputsStep.java:67)
at org.gradle.internal.execution.steps.RemovePreviousOutputsStep.execute(RemovePreviousOutputsStep.java:37)
at org.gradle.internal.execution.steps.CancelExecutionStep.execute(CancelExecutionStep.java:41)
at org.gradle.internal.execution.steps.TimeoutStep.executeWithoutTimeout(TimeoutStep.java:74)
at org.gradle.internal.execution.steps.TimeoutStep.execute(TimeoutStep.java:55)
at org.gradle.internal.execution.steps.CreateOutputsStep.execute(CreateOutputsStep.java:50)
at org.gradle.internal.execution.steps.CreateOutputsStep.execute(CreateOutputsStep.java:28)
at org.gradle.internal.execution.steps.CaptureStateAfterExecutionStep.executeDelegateBroadcastingChanges(CaptureStateAfterExecutionStep.java:100)
at org.gradle.internal.execution.steps.CaptureStateAfterExecutionStep.execute(CaptureStateAfterExecutionStep.java:72)
at org.gradle.internal.execution.steps.CaptureStateAfterExecutionStep.execute(CaptureStateAfterExecutionStep.java:50)
at org.gradle.internal.execution.steps.ResolveInputChangesStep.execute(ResolveInputChangesStep.java:40)
at org.gradle.internal.execution.steps.ResolveInputChangesStep.execute(ResolveInputChangesStep.java:29)
at org.gradle.internal.execution.steps.BuildCacheStep.executeWithoutCache(BuildCacheStep.java:179)
at org.gradle.internal.execution.steps.BuildCacheStep.executeAndStoreInCache(BuildCacheStep.java:139)
at org.gradle.internal.execution.steps.BuildCacheStep.lambda$executeWithCache$4(BuildCacheStep.java:106)
at org.gradle.internal.execution.steps.BuildCacheStep.lambda$executeWithCache$5(BuildCacheStep.java:106)
at org.gradle.internal.Try$Success.map(Try.java:164)
at org.gradle.internal.execution.steps.BuildCacheStep.executeWithCache(BuildCacheStep.java:80)
at org.gradle.internal.execution.steps.BuildCacheStep.lambda$execute$0(BuildCacheStep.java:69)
at org.gradle.internal.Either$Left.fold(Either.java:115)
at org.gradle.internal.execution.caching.CachingState.fold(CachingState.java:59)
at org.gradle.internal.execution.steps.BuildCacheStep.execute(BuildCacheStep.java:68)
at org.gradle.internal.execution.steps.BuildCacheStep.execute(BuildCacheStep.java:46)
at org.gradle.internal.execution.steps.StoreExecutionStateStep.execute(StoreExecutionStateStep.java:36)
at org.gradle.internal.execution.steps.StoreExecutionStateStep.execute(StoreExecutionStateStep.java:25)
at org.gradle.internal.execution.steps.RecordOutputsStep.execute(RecordOutputsStep.java:36)
at org.gradle.internal.execution.steps.RecordOutputsStep.execute(RecordOutputsStep.java:22)
at org.gradle.internal.execution.steps.SkipUpToDateStep.executeBecause(SkipUpToDateStep.java:91)
at org.gradle.internal.execution.steps.SkipUpToDateStep.lambda$execute$2(SkipUpToDateStep.java:55)
at org.gradle.internal.execution.steps.SkipUpToDateStep.execute(SkipUpToDateStep.java:55)
at org.gradle.internal.execution.steps.SkipUpToDateStep.execute(SkipUpToDateStep.java:37)
at org.gradle.internal.execution.steps.ResolveChangesStep.execute(ResolveChangesStep.java:65)
at org.gradle.internal.execution.steps.ResolveChangesStep.execute(ResolveChangesStep.java:36)
at org.gradle.internal.execution.steps.legacy.MarkSnapshottingInputsFinishedStep.execute(MarkSnapshottingInputsFinishedStep.java:37)
at org.gradle.internal.execution.steps.legacy.MarkSnapshottingInputsFinishedStep.execute(MarkSnapshottingInputsFinishedStep.java:27)
at org.gradle.internal.execution.steps.ResolveCachingStateStep.execute(ResolveCachingStateStep.java:77)
at org.gradle.internal.execution.steps.ResolveCachingStateStep.execute(ResolveCachingStateStep.java:38)
at org.gradle.internal.execution.steps.ValidateStep.execute(ValidateStep.java:108)
at org.gradle.internal.execution.steps.ValidateStep.execute(ValidateStep.java:55)
at org.gradle.internal.execution.steps.CaptureStateBeforeExecutionStep.execute(CaptureStateBeforeExecutionStep.java:71)
at org.gradle.internal.execution.steps.CaptureStateBeforeExecutionStep.execute(CaptureStateBeforeExecutionStep.java:45)
at org.gradle.internal.execution.steps.SkipEmptyWorkStep.executeWithNonEmptySources(SkipEmptyWorkStep.java:177)
at org.gradle.internal.execution.steps.SkipEmptyWorkStep.execute(SkipEmptyWorkStep.java:81)
at org.gradle.internal.execution.steps.SkipEmptyWorkStep.execute(SkipEmptyWorkStep.java:53)
at org.gradle.internal.execution.steps.RemoveUntrackedExecutionStateStep.execute(RemoveUntrackedExecutionStateStep.java:32)
at org.gradle.internal.execution.steps.RemoveUntrackedExecutionStateStep.execute(RemoveUntrackedExecutionStateStep.java:21)
at org.gradle.internal.execution.steps.legacy.MarkSnapshottingInputsStartedStep.execute(MarkSnapshottingInputsStartedStep.java:38)
at org.gradle.internal.execution.steps.LoadPreviousExecutionStateStep.execute(LoadPreviousExecutionStateStep.java:36)
at org.gradle.internal.execution.steps.LoadPreviousExecutionStateStep.execute(LoadPreviousExecutionStateStep.java:23)
at org.gradle.internal.execution.steps.CleanupStaleOutputsStep.execute(CleanupStaleOutputsStep.java:75)
at org.gradle.internal.execution.steps.CleanupStaleOutputsStep.execute(CleanupStaleOutputsStep.java:41)
at org.gradle.internal.execution.steps.ExecuteWorkBuildOperationFiringStep.lambda$execute$2(ExecuteWorkBuildOperationFiringStep.java:66)
at org.gradle.internal.execution.steps.ExecuteWorkBuildOperationFiringStep.execute(ExecuteWorkBuildOperationFiringStep.java:66)
at org.gradle.internal.execution.steps.ExecuteWorkBuildOperationFiringStep.execute(ExecuteWorkBuildOperationFiringStep.java:38)
at org.gradle.internal.execution.steps.AssignWorkspaceStep.lambda$execute$0(AssignWorkspaceStep.java:32)
at org.gradle.api.internal.tasks.execution.TaskExecution$4.withWorkspace(TaskExecution.java:293)
at org.gradle.internal.execution.steps.AssignWorkspaceStep.execute(AssignWorkspaceStep.java:30)
at org.gradle.internal.execution.steps.AssignWorkspaceStep.execute(AssignWorkspaceStep.java:21)
at org.gradle.internal.execution.steps.IdentityCacheStep.execute(IdentityCacheStep.java:37)
at org.gradle.internal.execution.steps.IdentityCacheStep.execute(IdentityCacheStep.java:27)
at org.gradle.internal.execution.steps.IdentifyStep.execute(IdentifyStep.java:47)
at org.gradle.internal.execution.steps.IdentifyStep.execute(IdentifyStep.java:34)
at org.gradle.internal.execution.impl.DefaultExecutionEngine$1.execute(DefaultExecutionEngine.java:64)
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeIfValid(ExecuteActionsTaskExecuter.java:145)
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.execute(ExecuteActionsTaskExecuter.java:134)
at org.gradle.api.internal.tasks.execution.FinalizePropertiesTaskExecuter.execute(FinalizePropertiesTaskExecuter.java:46)
at org.gradle.api.internal.tasks.execution.ResolveTaskExecutionModeExecuter.execute(ResolveTaskExecutionModeExecuter.java:51)
at org.gradle.api.internal.tasks.execution.SkipTaskWithNoActionsExecuter.execute(SkipTaskWithNoActionsExecuter.java:57)
at org.gradle.api.internal.tasks.execution.SkipOnlyIfTaskExecuter.execute(SkipOnlyIfTaskExecuter.java:74)
at org.gradle.api.internal.tasks.execution.CatchExceptionTaskExecuter.execute(CatchExceptionTaskExecuter.java:36)
at org.gradle.api.internal.tasks.execution.EventFiringTaskExecuter$1.executeTask(EventFiringTaskExecuter.java:77)
at org.gradle.api.internal.tasks.execution.EventFiringTaskExecuter$1.call(EventFiringTaskExecuter.java:55)
at org.gradle.api.internal.tasks.execution.EventFiringTaskExecuter$1.call(EventFiringTaskExecuter.java:52)
at org.gradle.internal.operations.DefaultBuildOperationRunner$CallableBuildOperationWorker.execute(DefaultBuildOperationRunner.java:204)
at org.gradle.internal.operations.DefaultBuildOperationRunner$CallableBuildOperationWorker.execute(DefaultBuildOperationRunner.java:199)
at org.gradle.internal.operations.DefaultBuildOperationRunner$2.execute(DefaultBuildOperationRunner.java:66)
at org.gradle.internal.operations.DefaultBuildOperationRunner$2.execute(DefaultBuildOperationRunner.java:59)
at org.gradle.internal.operations.DefaultBuildOperationRunner.execute(DefaultBuildOperationRunner.java:157)
at org.gradle.internal.operations.DefaultBuildOperationRunner.execute(DefaultBuildOperationRunner.java:59)
at org.gradle.internal.operations.DefaultBuildOperationRunner.call(DefaultBuildOperationRunner.java:53)
at org.gradle.internal.operations.DefaultBuildOperationExecutor.call(DefaultBuildOperationExecutor.java:78)
at org.gradle.api.internal.tasks.execution.EventFiringTaskExecuter.execute(EventFiringTaskExecuter.java:52)
at org.gradle.execution.plan.LocalTaskNodeExecutor.execute(LocalTaskNodeExecutor.java:42)
at org.gradle.execution.taskgraph.DefaultTaskExecutionGraph$InvokeNodeExecutorsAction.execute(DefaultTaskExecutionGraph.java:331)
at org.gradle.execution.taskgraph.DefaultTaskExecutionGraph$InvokeNodeExecutorsAction.execute(DefaultTaskExecutionGraph.java:318)
at org.gradle.execution.taskgraph.DefaultTaskExecutionGraph$BuildOperationAwareExecutionAction.lambda$execute$0(DefaultTaskExecutionGraph.java:314)
at org.gradle.internal.operations.CurrentBuildOperationRef.with(CurrentBuildOperationRef.java:80)
at org.gradle.execution.taskgraph.DefaultTaskExecutionGraph$BuildOperationAwareExecutionAction.execute(DefaultTaskExecutionGraph.java:314)
at org.gradle.execution.taskgraph.DefaultTaskExecutionGraph$BuildOperationAwareExecutionAction.execute(DefaultTaskExecutionGraph.java:303)
at org.gradle.execution.plan.DefaultPlanExecutor$ExecutorWorker.execute(DefaultPlanExecutor.java:463)
at org.gradle.execution.plan.DefaultPlanExecutor$ExecutorWorker.run(DefaultPlanExecutor.java:380)
at org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.onExecute(ExecutorPolicy.java:64)
at org.gradle.internal.concurrent.AbstractManagedExecutor$1.run(AbstractManagedExecutor.java:47)
Caused by: java.lang.ClassNotFoundException: com.intellij.ant.InstrumentIdeaExtensions
at org.apache.tools.ant.AntClassLoader.findClassInComponents(AntClassLoader.java:1402)
at org.apache.tools.ant.AntClassLoader.findClass(AntClassLoader.java:1357)
at org.apache.tools.ant.AntClassLoader.loadClass(AntClassLoader.java:1112)
at org.apache.tools.ant.taskdefs.Definer.addDefinition(Definer.java:569)
... 137 more
Please sign in to leave a comment.
Hi,
Please start with updating the plugin version to the latest version.
org.jetbrains.intellij version: 1.17.3
You can also consider migrating to 2.x: https://plugins.jetbrains.com/docs/intellij/tools-intellij-platform-gradle-plugin.html
If the problem persists, please share full build script configuration (all Gradle-related files) at least.
Thank you for your reply, i tried update the org.jetbrains.intellij version to 1.17.3, but the problem persists, this is all Gradle-related files:
build.gradle.kts:
plugins {
id("java")
id("org.jetbrains.kotlin.jvm") version "1.9.0"
id("org.jetbrains.intellij") version "1.17.3"
jacoco
kotlin("plugin.lombok") version "1.9.10"
}
group = "com.xxx.xxx"
version = "1.0.14"
repositories {
mavenLocal()
maven(url = "https://mvnrepo.xxx-inc.com/mvn/repository")
}
configurations.all {
resolutionStrategy.cacheChangingModulesFor(0, TimeUnit.SECONDS)
resolutionStrategy.cacheDynamicVersionsFor(0, TimeUnit.SECONDS)
}
// Configure Gradle IntelliJ Plugin
// Read more: https://plugins.jetbrains.com/docs/intellij/tools-gradle-intellij-plugin.html
intellij {
val localVersion = System.getenv("xxx.idea.version")
val localPlatform = System.getenv("xxx.idea.platform")
version.set(localVersion ?: "2023.3.2")
type.set(localPlatform ?: "IU") // Target IDE Platform
plugins.set(
listOf(
file("sandbox/xxx-devkit-0.0.18.jar"),
"com.intellij.java",
"Git4Idea",
"org.jetbrains.idea.maven",
)
)
// set intellijRepository will lead to build failure: ClassNotFoundException: com.intellij.ant.InstrumentIdeaExtensions
// intellijRepository.set("https://xxx.com/intellij-repository")
}
dependencies {
implementation("com.knuddels", "jtokkit", "1.0.0")
compileOnly("com.xxx", "taotian-devkit", "1.0.0")
implementation(project(":rule"))
implementation("com.google.guava", "guava", "24.1-jre")
implementation("org.reflections", "reflections", "0.10.2") {
exclude("org.javassist")
}
implementation("commons-io", "commons-io", "2.4")
implementation("org.apache.ant", "ant", "1.9.13")
implementation("org.apache.commons", "commons-collections4", "4.4")
implementation("org.javassist", "javassist", "3.21.0-GA")
implementation("org.slf4j", "slf4j-api", "1.7.30")
implementation("ch.qos.logback:logback-classic:1.4.12")
testImplementation("org.assertj", "assertj-core", "3.19.0")
testImplementation("junit:junit:4.13.2")
compileOnly("org.projectlombok:lombok:1.18.30")
testCompileOnly("org.projectlombok:lombok:1.18.30")
annotationProcessor("org.projectlombok:lombok:1.18.30")
implementation("com.xxx", "fastjson", "2.0.42")
implementation("com.github.lgooddatepicker", "LGoodDatePicker", "11.2.1")
implementation("com.squareup.retrofit2", "retrofit", "2.9.0")
implementation("com.xxx", "xxx-xxx-management-api", "1.1.0")
testImplementation("org.mockito", "mockito-core", "5.7.0")
testImplementation("org.assertj", "assertj-core", "3.18.1")
}
// 把测试结果转为 maven 的格式和位置, 不然 Aone ci 不能识别
tasks.register<Copy>("copyTestResults") {
dependsOn("test")
from("build/test-results/test")
into("target/surefire-reports")
include("*.xml")
rename { fileName ->
fileName.removePrefix("TEST-")
}
}
// 把测试覆盖率转为 maven 的格式和位置, 不然 Aone ci 不能识别
tasks.register<Copy>("copyJacocoResults") {
dependsOn("jacocoTestReport")
from("build/reports/jacoco/test/html")
from("build/reports/jacoco/test/jacocoTestReport.xml") {
rename {
"jacoco.xml"
}
}
into("target/site/jacoco")
}
// 在 兼容性 CI 运行前替换 description, 因为 description 不能有中文
tasks.register("preparePluginXml") {
val pluginXmlFile = project.file("${project.projectDir}/src/main/resources/META-INF/plugin.xml")
doLast {
val content = pluginXmlFile.readText()
val modifiedContent = content.replace(
Regex("(?s)<description>.*?</description>"),
// description 最少 40 个字符
"<description>1111111111111111111111111111111111111111</description>"
)
pluginXmlFile.writeText(modifiedContent)
}
}
tasks.register<Copy>("combineHtmlFiles") {
// 配置源目录,假定为'src/main/resources'
val srcDir = File("${projectDir}/build/reports/pluginVerifier")
// 创建一个临时目录来存储合并后的HTML内容
val tempDir = File("${projectDir}/build/tmp/combinedHtml")
from(srcDir) {
include("**/*.html") // 包含所有HTML文件
}
into(tempDir) // 指定临时目录
val combinedHtmlFile = File("${projectDir}/report.html")
// 执行合并动作
doLast {
tempDir.walkTopDown().filter { it.isFile && it.extension == "html" }.forEach { file ->
combinedHtmlFile.appendText(file.readText() + "\n") // 将文件内容追加到合并文件
}
}
}
tasks {
// https://plugins.jetbrains.com/docs/intellij/tools-gradle-intellij-plugin.html#tasks-runpluginverifier
runPluginVerifier {
// 指定要检查的 IDE 版本(社区版和专业版)
// 这里使用了最近5个版本的发布号,你需要确保列表中的版本号是正确的
var verifyVersions = listOf(
"IC-2023.3", // 社区版
"IC-2023.3.2", // 社区版
"IC-2023.2.5", // 社区版
"IC-2023.1.5", // 社区版
"IC-2022.3.3", // 社区版
"IU-2023.3", // 专业版
"IU-2023.3.2", // 专业版
"IU-2023.2.5", // 专业版
"IU-2023.1.5", // 专业版
"IU-2022.3.3", // 专业版
// 继续添加其他需要的版本
)
// CI 避免跑太多版本, 太慢了
if (project.hasProperty("miniVerifyVersions")) {
verifyVersions = findProperty("miniVerifyVersions")?.toString()?.split(",") ?: emptyList()
}
ideVersions.set(
verifyVersions
)
// 指定需要一起验证的第三方插件信息
externalPrefixes.set(listOf("com.xxx.xxx.xxx.insight"))
// 如果需要,设置其他选项
// failureLevel.set("COMPATIBILITY_WARNINGS") // 这将使得验证器对于兼容性警告不返回错误
}
// Set the JVM compatibility versions
withType<JavaCompile> {
sourceCompatibility = "17"
targetCompatibility = "17"
options.encoding = "UTF-8"
}
withType<org.jetbrains.kotlin.gradle.tasks.KotlinCompile> {
kotlinOptions.jvmTarget = "17"
}
jacocoTestReport {
reports {
xml.required.set(true)
csv.required.set(false)
html.required.set(true) // HTML格式的报告是可视化的,默认启用
}
// 设置包含在覆盖率报告中的类文件
classDirectories.setFrom(files(instrumentCode).asFileTree.matching {
exclude("com/xxx/xxx/ui/**")
exclude("com/xxx/xxx/applications/inspection/sonar/rule/**")
exclude("com/xxx/xxx/**/hotfix/**")
exclude("com/xxx/xxx/applications/actions/project/initializr/**")
exclude("com/xxx/xxx/domain/common/quicktest/**")
exclude("com/xxx/xxx/domain/services/quicktest/interfaces/**")
exclude("com/xxx/xxx/applications/actions/quicktest/handler**")
exclude("com/xxx/xxx/applications/actions/quicktest/**")
exclude("com/xxx/xxx/domain/services/quicktest.QuickTestHsfBeanService");
exclude("com/xxx/xxx/domain/services/quicktest.QuickTestPsiService");
})
}
jacocoTestCoverageVerification {
classDirectories.setFrom(instrumentCode)
}
withType<Jar> {
// 设置处理重复文件的策略 (如:EXCLUDE, INCLUDE, FAIL, WARN)
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
}
withType<Test> {
configure<JacocoTaskExtension> {
isIncludeNoLocationClasses = true
excludes = listOf("jdk.internal.*")
}
}
prepareTestingSandbox {}
test {
useJUnit()
dependsOn("prepareTestingSandbox")
testLogging {
events("passed", "skipped", "failed")
}
ignoreFailures = true
if (project.hasProperty("enableJacoco") && project.property("enableJacoco") == "true") {
finalizedBy("jacocoTestReport")
}
}
runIde {
autoReloadPlugins = true
if (!project.hasProperty("CITest")) {
requiredPluginIds = listOf("com.xxx.xxx.xxx", "Lombook Plugin")
} else {
jbrVersion = "jbr_jcef-17.0.9-linux-x64-b1087.9"
}
}
patchPluginXml {
sinceBuild.set("223")
untilBuild.set("999.*")
}
signPlugin {
certificateChain.set(System.getenv("CERTIFICATE_CHAIN"))
privateKey.set(System.getenv("PRIVATE_KEY"))
password.set(System.getenv("PRIVATE_KEY_PASSWORD"))
}
publishPlugin {
host.set("https://ide.xxx-inc.com")
token.set("aone")
}
}
gralde.properties:
# Opt-out flag for bundling Kotlin standard library -> https://jb.gg/intellij-platform-kotlin-stdlib
kotlin.stdlib.default.dependency=false
# Enable Gradle Configuration Cache -> https://docs.gradle.org/current/userguide/configuration_cache.html
org.gradle.configuration-cache=true
# Enable Gradle Build Cache -> https://docs.gradle.org/current/userguide/build_cache.html
org.gradle.caching=true
org.gradle.configuration-cache.problems=warn
org.jetbrains.intellij.buildFeature.selfUpdateCheck=false
settings.gradle.kts:
pluginManagement {
repositories {
maven(url = "https://maven.xxx.com/repository/google")
maven(url = "https://mvnrepo.xxx-inc.com/mvn/repository")
maven(url = "https://maven.xxx.com/repository/central")
mavenCentral()
gradlePluginPortal()
}
}
rootProject.name = "xxx"
include("rule")
gradle-wrapper.properties:
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
#distributionUrl=https\://mirrors.cloud.tencent.com/gradle/gradle-8.4-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
Hi,
Please try hints provided by users in this issue:
https://github.com/JetBrains/intellij-platform-gradle-plugin/issues/1255
If it doesn't solve the problem, provide your context in the issue.