Extending JUnit plugin

Answered

Hi!
I've been trying to extend JUnit plugin in order to access JUnitConfiguration (extend it or access it's methods). Compiling project I get: 

JUnitConfiguration runProfile = (JUnitConfiguration) environment.getRunProfile();
^
class file for com.intellij.execution.JavaTestConfigurationWithDiscoverySupport not found

I've added JUnit in build.gradle:

intellij {
plugins 'JUnit'
}

Maybe there's another way required to access JUnitConfiguration?

Thanks in advance!

0
4 comments

It is located in Java plugin, so Java plugin needs to be added as well as dependency, see https://blog.jetbrains.com/platform/2019/06/java-functionality-extracted-as-a-plugin/

0

I'm running into a similar situation:

This is how my plugin.xml file looks like:

<depends>com.intellij.modules.platform</depends>
<depends>com.intellij.modules.java</depends>

and this is how my gradle file looks like:

intellij {
    version.set("2023.1.5")
    type.set("IC") // Target IDE Platform

    plugins.set(listOf("java", "JUnit"))
}

I'm positive “JUnit” is correct, as adding that makes my compile-time dependency on JUnitConfiguration compile. But when running my plugin, I get a

Caused by: java.lang.NoClassDefFoundError: com/intellij/execution/junit/JUnitConfiguration

What may I be missing here?

Thanks

0

Please see for Java plugin dependency: https://plugins.jetbrains.com/docs/intellij/plugin-compatibility.html#java
You must also add a dependency on JUnit plugin in plugin.xml: https://plugins.jetbrains.com/docs/intellij/plugin-dependencies.html

If java.lang.NoClassDefFoundError occurs at runtime, it means that either Step 3 was omitted or loading the plugin dependency failed (please check log files from Development Instance).

0

Please sign in to leave a comment.