Skip to content

Commit 8d914dc

Browse files
committedNov 6, 2018
GRD: exclude jars related to java support from classpath.
It should help to avoid accidental using of java API which leads to `NoClassDefFoundError` in small IDEs
1 parent ab598e1 commit 8d914dc

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed
 

‎build.gradle.kts

+10
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,11 @@ val CI = System.getenv("CI") != null
2323
val channel = prop("publishChannel")
2424
val platformVersion = prop("platformVersion")
2525

26+
val excludedJars = listOf(
27+
"java-api.jar",
28+
"java-impl.jar"
29+
)
30+
2631
plugins {
2732
idea
2833
kotlin("jvm") version "1.3.0"
@@ -94,6 +99,11 @@ allprojects {
9499
}
95100

96101
afterEvaluate {
102+
val mainSourceSet = sourceSets.getByName("main")
103+
val mainClassPath = mainSourceSet.compileClasspath
104+
val exclusion = mainClassPath.filter { it.name in excludedJars }
105+
mainSourceSet.compileClasspath = mainClassPath - exclusion
106+
97107
tasks.withType<AbstractTestTask> {
98108
testLogging {
99109
if (hasProp("showTestStatus") && prop("showTestStatus").toBoolean()) {

0 commit comments

Comments
 (0)
Please sign in to comment.