Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

java.lang.NoClassDefFoundError: org/jetbrains/kotlin/preprocessor/PreprocessorKt #226

Closed
BorzdeG opened this issue Jun 14, 2018 · 3 comments

Comments

@BorzdeG
Copy link

BorzdeG commented Jun 14, 2018

When Kotlin was updated from 1.2.41 to 1.2.50, the "lost" class was added.

xception in thread "main" java.lang.NoClassDefFoundError: org/jetbrains/kotlin/preprocessor/PreprocessorKt
        at com.github.shyiko.ktlint.Main$loadReporter$2.invoke(Main.kt:396)
        at com.github.shyiko.ktlint.Main.loadReporter(Main.kt:410)
        at com.github.shyiko.ktlint.Main.main(Main.kt:262)
Caused by: java.lang.ClassNotFoundException: org.jetbrains.kotlin.preprocessor.PreprocessorKt
        at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
        at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:349)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
        ... 3 more

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':ktlintMainCheck'.
> Process 'command '/Users/victor.alenkov/.jvm/oracle-jdk-8u171/Home/bin/java'' finished with non-zero exit value 1

Gradle command run: check

gradle.properties:

kotlinVersion=1.2.50

build.gradle.kts:

import org.jetbrains.kotlin.gradle.dsl.KotlinProjectExtension
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
import org.jetbrains.kotlin.gradle.plugin.KotlinPlatformJvmPlugin

tasks.withType<Wrapper> {
  distributionType = Wrapper.DistributionType.BIN
  gradleVersion = "4.7"
}

buildscript {
  val kotlinVersion: String by extra

  repositories {
    gradlePluginPortal()
  }

  dependencies {
    classpath(kotlin("gradle-plugin", kotlinVersion))
    classpath("gradle.plugin.org.jlleitschuh.gradle:ktlint-gradle:latest.release")
  }
}

repositories {
  jcenter()
}

apply {
  plugin<BasePlugin>()
  plugin<KotlinPlatformJvmPlugin>()
  plugin("org.jlleitschuh.gradle.ktlint")
}

afterEvaluate {
  plugins.withType(JavaBasePlugin::class.java) {
    configure<JavaPluginConvention> {
      sourceCompatibility = JavaVersion.VERSION_1_8
    }
  }

  tasks.withType(KotlinCompile::class.java) {
    kotlinOptions {
      jvmTarget = JavaVersion.VERSION_1_8.toString()
    }
  }
}

val kotlinVersion: String by extra

configurations.all {
  resolutionStrategy {
    eachDependency {
      when (requested.group) {
        "org.jetbrains.kotlin" -> useVersion(kotlinVersion)
      }
    }
  }
}
@eskatos
Copy link

eskatos commented Jun 21, 2018

Same here after upgrading Kotlin to 1.2.50:

> Task :ktlintMainCheck FAILED
    Exception in thread "main" java.lang.NoClassDefFoundError: org/jetbrains/kotlin/preprocessor/PreprocessorKt
        at com.github.shyiko.ktlint.Main$loadReporter$2.invoke(Main.kt:396)
        at com.github.shyiko.ktlint.Main.loadReporter(Main.kt:410)
        at com.github.shyiko.ktlint.Main.main(Main.kt:262)
    Caused by: java.lang.ClassNotFoundException: org.jetbrains.kotlin.preprocessor.PreprocessorKt
        at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
        at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:349)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
        ... 3 more

@eskatos
Copy link

eskatos commented Jun 21, 2018

Looks like this is already fixed on master by f06f7db

@shyiko
Copy link
Collaborator

shyiko commented Jun 23, 2018

Fixed in 0.24.0.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants