java.lang.NoClassDefFoundError in test after upgrading on 2019.2

Answered

Hi there. When I changed IDEA version in build.gradle, all tests started failing with the following error:

com.badoo.component.plugin.zabbixdiscovery.MetricCompletionTest > initializationError FAILED
java.lang.NoClassDefFoundError: com/intellij/psi/impl/JavaPsiFacadeEx

Caused by:
java.lang.ClassNotFoundException: com.intellij.psi.impl.JavaPsiFacadeEx

while the plugin is working fine.

I don't even understand what info I can provide here. The plugin is built with Gradle Wrapper.

 

build.gradle:

import groovy.xml.MarkupBuilder
import groovy.xml.XmlUtil
import groovy.xml.*
import java.util.regex.Matcher

buildscript {
repositories {
mavenCentral()
maven { url 'http://dl.bintray.com/jetbrains/intellij-plugin-service' }
maven { url "https://jetbrains.bintray.com/intellij-third-party-dependencies" }
}
dependencies {
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:${kotlinVersion}"
}
}

plugins {
id "org.jetbrains.intellij" version "0.4.1"
id 'com.palantir.git-version' version "0.11.0"
}

repositories {
mavenCentral()
}

apply plugin: 'idea'
apply plugin: 'org.jetbrains.intellij'
apply plugin: 'java'
apply plugin: 'kotlin'

intellij {
version ideaVersion
updateSinceUntilBuild false
plugins = [
"com.jetbrains.php:${phpPluginVersion}",
"io.protostuff.protostuff-jetbrains-plugin:${protostuffPluginVersion}",
'CSS',
'java-i18n',
'properties'
]
pluginName 'Badoo Component'
}
dependencies {
compile "javax.websocket:javax.websocket-client-api:1.1"
compile "org.glassfish:javax.json:1.1.4"
compile 'org.glassfish.tyrus.bundles:tyrus-standalone-client:1.15'
}

sourceSets {
main.java.srcDirs = ['src']
main.kotlin.srcDirs = ['src']
main.resources.srcDirs = ['resources']
test.kotlin.srcDirs = ['src/test/kotlin']
}

/*
PhpStorm up to v2018.3 is built and distributed with Java v8 and its
Java Runtime only recognizes class file versions up to 52.0
Without following lines we'll get an incompatible files (that ones which written in Java)
this is specifically for Java-files compilation
*/
targetCompatibility = '8'
sourceCompatibility = '8'
/*
error: Super calls to Java default methods are prohibited in JVM target 1.6. Recompile with '-jvm-target 1.8'
this is specifically for Kotlin-files compilation
*/
tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile).all {
kotlinOptions {
jvmTarget = "${javaVersion}"
}
}

test {
testLogging {
exceptionFormat = 'full'
}
}

wrapper {
gradleVersion '5.2'
}

2 comments
Comment actions Permalink

Hi,

this saved my life. I was having the same problem and then found this question. Thanks!

0

Please sign in to leave a comment.