intellij kotlin dependency failed to find premain-class

Viewed 238

I recently wanted to learn kotlin coroutines and add them to my maven project. I added this to the pom.xml:

<dependency>
    <groupId>org.jetbrains.kotlinx</groupId>
    <artifactId>kotlinx-coroutines-core</artifactId>
    <version>1.4.3</version>
</dependency>

Sounds easy enough but now when I want to start my project I get the following errors:

"C:\Program Files\AdoptOpenJDK\jdk-11.0.10-hotspot\bin\java.exe"
Failed to find Premain-Class manifest attribute in C:\Users\j\.m2\repository\org\jetbrains\kotlinx\kotlinx-coroutines-core\1.4.3\kotlinx-coroutines-core-1.4.3.jar
Error occurred during initialization of VM
agent library failed to init: instrument

Process finished with exit code 1

That's pretty much all I did in Intellij. Is there anything I missed which is required to be able to use coroutines?

When I compile&run the project with maven as follows it works:

mvn -pl client -am clean install package
cd client/target
java -jar client-jar-with-dependencies.jar

The entire pom.xml looks like this: https://pastebin.com/uQXzFkSK

/edit1: Seems like it happens only when debugging. Running the app normally works as expected.

/edit2: Finally I found a ticket which seems to cover this problem: https://youtrack.jetbrains.com/issue/KTIJ-5659

Thank you for your help!

0 Answers
Related