@@ -2,14 +2,15 @@ import org.jetbrains.intellij.platform.gradle.TestFrameworkType
22
33plugins {
44 id(" java" )
5- kotlin(" jvm" ) version " 2.2.0 "
6- id(" org.jetbrains.intellij.platform" ) version " 2.10.2 "
7- kotlin(" plugin.compose" ) version " 2.2.0 "
8- kotlin(" plugin.serialization" ) version " 2.2.0 "
5+ kotlin(" jvm" )
6+ id(" org.jetbrains.intellij.platform" )
7+ kotlin(" plugin.compose" )
8+ kotlin(" plugin.serialization" )
99}
1010
1111group = " cc.unitmesh.devins"
12- version = project.findProperty(" mppVersion" ) as String? ? : " 0.3.2"
12+ val mppVersion = project.findProperty(" mppVersion" ) as String? ? : " 0.3.2"
13+ version = mppVersion
1314
1415kotlin {
1516 jvmToolchain(21 )
@@ -25,19 +26,96 @@ kotlin {
2526
2627repositories {
2728 mavenCentral()
29+ google()
30+ // Required for mpp-ui's webview dependencies (jogamp)
31+ maven(" https://jogamp.org/deployment/maven" )
32+ maven(" https://oss.sonatype.org/content/repositories/snapshots/" )
33+ maven(" https://packages.jetbrains.team/maven/p/ij/intellij-dependencies/" )
2834
2935 intellijPlatform {
3036 defaultRepositories()
3137 }
32- google()
3338}
3439
3540dependencies {
36- // Kotlinx serialization for JSON
37- implementation(" org.jetbrains.kotlinx:kotlinx-serialization-json:1.7.3" )
38- implementation(" org.jetbrains.kotlinx:kotlinx-coroutines-core:1.10.1" )
41+ // Depend on mpp-ui and mpp-core JVM targets for shared UI components and ConfigManager
42+ // For KMP projects, we need to depend on the JVM target specifically
43+ // IMPORTANT: Exclude ALL transitive dependencies that conflict with IntelliJ's bundled libraries
44+ implementation(" cc.unitmesh.devins:mpp-ui-jvm" ) {
45+ // Exclude all Compose dependencies - IntelliJ provides its own via bundledModules
46+ exclude(group = " org.jetbrains.compose" )
47+ exclude(group = " org.jetbrains.compose.runtime" )
48+ exclude(group = " org.jetbrains.compose.foundation" )
49+ exclude(group = " org.jetbrains.compose.material3" )
50+ exclude(group = " org.jetbrains.compose.material" )
51+ exclude(group = " org.jetbrains.compose.ui" )
52+ exclude(group = " org.jetbrains.compose.desktop" )
53+ exclude(group = " org.jetbrains.compose.components" )
54+ exclude(group = " org.jetbrains.compose.animation" )
55+ exclude(group = " org.jetbrains.skiko" )
56+ // Exclude kotlinx libraries - IntelliJ provides its own
57+ exclude(group = " org.jetbrains.kotlinx" , module = " kotlinx-coroutines-core" )
58+ exclude(group = " org.jetbrains.kotlinx" , module = " kotlinx-coroutines-core-jvm" )
59+ exclude(group = " org.jetbrains.kotlinx" , module = " kotlinx-coroutines-swing" )
60+ exclude(group = " org.jetbrains.kotlinx" , module = " kotlinx-serialization-json" )
61+ exclude(group = " org.jetbrains.kotlinx" , module = " kotlinx-serialization-json-jvm" )
62+ exclude(group = " org.jetbrains.kotlinx" , module = " kotlinx-serialization-json-io" )
63+ exclude(group = " org.jetbrains.kotlinx" , module = " kotlinx-serialization-json-io-jvm" )
64+ exclude(group = " org.jetbrains.kotlinx" , module = " kotlinx-serialization-core" )
65+ exclude(group = " org.jetbrains.kotlinx" , module = " kotlinx-serialization-core-jvm" )
66+ exclude(group = " org.jetbrains.kotlinx" , module = " kotlinx-io-core" )
67+ exclude(group = " org.jetbrains.kotlinx" , module = " kotlinx-io-core-jvm" )
68+ // Exclude webview/KCEF - not needed in IntelliJ and causes issues
69+ exclude(group = " io.github.kevinnzou" )
70+ exclude(group = " dev.datlag" )
71+ // Exclude other UI libraries that may conflict
72+ exclude(group = " com.mohamedrejeb.richeditor" )
73+ exclude(group = " cafe.adriel.bonsai" )
74+ exclude(group = " com.mikepenz" )
75+ exclude(group = " org.jetbrains.jediterm" )
76+ exclude(group = " org.jetbrains.pty4j" )
77+ exclude(group = " io.github.vinceglb" )
78+ // Exclude SQLDelight - not needed in IntelliJ plugin
79+ exclude(group = " app.cash.sqldelight" )
80+ }
81+ implementation(" cc.unitmesh.devins:mpp-core-jvm" ) {
82+ // Exclude Compose dependencies from mpp-core as well
83+ exclude(group = " org.jetbrains.compose" )
84+ exclude(group = " org.jetbrains.compose.runtime" )
85+ exclude(group = " org.jetbrains.compose.foundation" )
86+ exclude(group = " org.jetbrains.compose.material3" )
87+ exclude(group = " org.jetbrains.compose.material" )
88+ exclude(group = " org.jetbrains.compose.ui" )
89+ exclude(group = " org.jetbrains.skiko" )
90+ // Exclude kotlinx libraries - IntelliJ provides its own
91+ exclude(group = " org.jetbrains.kotlinx" , module = " kotlinx-coroutines-core" )
92+ exclude(group = " org.jetbrains.kotlinx" , module = " kotlinx-coroutines-core-jvm" )
93+ exclude(group = " org.jetbrains.kotlinx" , module = " kotlinx-serialization-json" )
94+ exclude(group = " org.jetbrains.kotlinx" , module = " kotlinx-serialization-json-jvm" )
95+ exclude(group = " org.jetbrains.kotlinx" , module = " kotlinx-serialization-json-io" )
96+ exclude(group = " org.jetbrains.kotlinx" , module = " kotlinx-serialization-json-io-jvm" )
97+ exclude(group = " org.jetbrains.kotlinx" , module = " kotlinx-serialization-core" )
98+ exclude(group = " org.jetbrains.kotlinx" , module = " kotlinx-serialization-core-jvm" )
99+ exclude(group = " org.jetbrains.kotlinx" , module = " kotlinx-io-core" )
100+ exclude(group = " org.jetbrains.kotlinx" , module = " kotlinx-io-core-jvm" )
101+ }
102+
103+ // Use platform-provided kotlinx libraries to avoid classloader conflicts
104+ compileOnly(" org.jetbrains.kotlinx:kotlinx-serialization-json:1.7.3" )
105+ compileOnly(" org.jetbrains.kotlinx:kotlinx-coroutines-core:1.10.1" )
106+
107+ // Ktor HTTP Client for LLM API calls - use compileOnly for libraries that may conflict
108+ compileOnly(" io.ktor:ktor-client-core:3.2.2" )
109+ compileOnly(" io.ktor:ktor-client-cio:3.2.2" )
110+ compileOnly(" io.ktor:ktor-client-content-negotiation:3.2.2" )
111+ compileOnly(" io.ktor:ktor-serialization-kotlinx-json:3.2.2" )
112+ compileOnly(" io.ktor:ktor-client-logging:3.2.2" )
39113
40114 testImplementation(kotlin(" test" ))
115+ testImplementation(" org.junit.jupiter:junit-jupiter-api:5.11.4" )
116+ testRuntimeOnly(" org.junit.jupiter:junit-jupiter-engine:5.11.4" )
117+ // JUnit 4 is required by IntelliJ Platform test infrastructure (JUnit5TestEnvironmentInitializer)
118+ testRuntimeOnly(" junit:junit:4.13.2" )
41119
42120 intellijPlatform {
43121 // Target IntelliJ IDEA 2025.2+ for Compose support
@@ -55,14 +133,19 @@ dependencies {
55133 " intellij.platform.compose"
56134 )
57135
58- testFramework(TestFrameworkType .Platform )
136+ // Note: testFramework(TestFrameworkType.Platform) is removed because:
137+ // 1. It requires JUnit 4 (junit.framework.TestCase) which conflicts with JUnit 5
138+ // 2. JewelRendererTest uses JUnit 5 and doesn't need IntelliJ Platform
139+ // 3. IdeaAgentViewModelTest (which needs Platform) is temporarily disabled
140+ // To run platform tests, uncomment testFramework and add JUnit 4 dependency
141+ // testFramework(TestFrameworkType.Platform)
59142 }
60143}
61144
62145intellijPlatform {
63146 pluginConfiguration {
64147 name = " AutoDev Compose UI"
65- version = project.findProperty( " mppVersion" ) as String? ? : " 0.3.2 "
148+ version = mppVersion
66149
67150 ideaVersion {
68151 sinceBuild = " 252"
@@ -77,4 +160,51 @@ tasks {
77160 test {
78161 useJUnitPlatform()
79162 }
163+
164+ // Task to verify no conflicting dependencies are included
165+ register(" verifyNoDuplicateDependencies" ) {
166+ group = " verification"
167+ description = " Verifies that no Compose/Kotlinx dependencies are included that would conflict with IntelliJ's bundled versions"
168+
169+ doLast {
170+ val forbiddenPatterns = listOf (
171+ " org.jetbrains.compose" ,
172+ " org.jetbrains.skiko" ,
173+ " kotlinx-coroutines-core" ,
174+ " kotlinx-coroutines-swing" ,
175+ " kotlinx-serialization-json" ,
176+ " kotlinx-serialization-core"
177+ )
178+
179+ val runtimeClasspath = configurations.getByName(" runtimeClasspath" )
180+ val violations = mutableListOf<String >()
181+
182+ runtimeClasspath.resolvedConfiguration.resolvedArtifacts.forEach { artifact ->
183+ val id = artifact.moduleVersion.id
184+ val fullName = " ${id.group} :${id.name} :${id.version} "
185+ forbiddenPatterns.forEach { pattern ->
186+ if (fullName.contains(pattern)) {
187+ violations.add(fullName)
188+ }
189+ }
190+ }
191+
192+ if (violations.isNotEmpty()) {
193+ throw GradleException ("""
194+ |DEPENDENCY CONFLICT DETECTED!
195+ |The following dependencies will conflict with IntelliJ's bundled libraries:
196+ |${violations.joinToString(" \n " ) { " - $it " }}
197+ |
198+ |These dependencies must be excluded from mpp-ui and mpp-core.
199+ """ .trimMargin())
200+ } else {
201+ println (" ✓ No conflicting dependencies found in runtime classpath" )
202+ }
203+ }
204+ }
205+
206+ // Run verification before build
207+ named(" build" ) {
208+ dependsOn(" verifyNoDuplicateDependencies" )
209+ }
80210}
0 commit comments