Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Gradle plugin - can't run detektCheck with JDK 9 #873

Closed
samClarenc opened this issue Apr 20, 2018 · 6 comments
Closed

Gradle plugin - can't run detektCheck with JDK 9 #873

samClarenc opened this issue Apr 20, 2018 · 6 comments
Labels
Milestone

Comments

@samClarenc
Copy link

Hello,

I have a java 9 application that I want to "kotlinize".

When I run

./gradlew detektCheck

with a java 9, I get the following error :


Exception in thread "main" java.lang.ExceptionInInitializerError
        at io.gitlab.arturbosch.detekt.core.KtCompiler.<init>(KtCompiler.kt:17)
        at io.gitlab.arturbosch.detekt.core.KtTreeCompiler$Companion.instance(KtTreeCompiler.kt:16)
        at io.gitlab.arturbosch.detekt.core.DetektFacade.<init>(DetektFacade.kt:21)
        at io.gitlab.arturbosch.detekt.core.DetektFacade$Companion.create(DetektFacade.kt:83)
        at io.gitlab.arturbosch.detekt.core.DetektFacade$Companion.create(DetektFacade.kt:69)
        at io.gitlab.arturbosch.detekt.cli.Runner.execute(Runner.kt:20)
        at io.gitlab.arturbosch.detekt.cli.Main.main(Main.kt:19)
Caused by: java.lang.IllegalStateException: LOGGING: Loading modules: [java.se, javafx.base, javafx.controls, javafx.fxml, javafx.graphics, javafx.media, javafx.swing, javafx.web, jdk.accessibility, jdk.attach, jdk.compiler, jdk.dynalink, jdk.httpserver, jdk.incubator.httpclient, jdk.jartool, jdk.javadoc, jdk.jconsole, jdk.jdi, jdk.jfr, jdk.jshell, jdk.jsobject, jdk.management, jdk.management.cmm, jdk.management.jfr, jdk.management.resource, jdk.net, jdk.packager, jdk.packager.services, jdk.plugin.dom, jdk.scripting.nashorn, jdk.sctp, jdk.security.auth, jdk.security.jgss, jdk.unsupported, jdk.xml.dom, oracle.desktop, oracle.net, java.base, java.rmi, java.sql, java.logging, java.xml, java.scripting, java.management.rmi, java.management, java.xml.crypto, java.prefs, java.datatransfer, java.sql.rowset, java.naming, java.instrument, java.compiler, java.security.jgss, java.desktop, java.security.sasl, jdk.internal.jvmstat, jdk.management.agent, jdk.jdwp.agent, jdk.internal.ed, jdk.internal.opt, jdk.internal.le, jdk.jdeps, jdk.jlink] (no MessageCollector configured)
        at org.jetbrains.kotlin.cli.jvm.compiler.ClasspathRootsResolver.report(ClasspathRootsResolver.kt:314)
        at org.jetbrains.kotlin.cli.jvm.compiler.ClasspathRootsResolver.report$default(ClasspathRootsResolver.kt:312)
        at org.jetbrains.kotlin.cli.jvm.compiler.ClasspathRootsResolver.addModularRoots(ClasspathRootsResolver.kt:254)
        at org.jetbrains.kotlin.cli.jvm.compiler.ClasspathRootsResolver.computeRoots(ClasspathRootsResolver.kt:124)
        at org.jetbrains.kotlin.cli.jvm.compiler.ClasspathRootsResolver.convertClasspathRoots(ClasspathRootsResolver.kt:79)
        at org.jetbrains.kotlin.cli.jvm.compiler.KotlinCoreEnvironment.<init>(KotlinCoreEnvironment.kt:223)
        at org.jetbrains.kotlin.cli.jvm.compiler.KotlinCoreEnvironment.<init>(KotlinCoreEnvironment.kt:114)
        at org.jetbrains.kotlin.cli.jvm.compiler.KotlinCoreEnvironment$Companion.createForProduction(KotlinCoreEnvironment.kt:401)
        at io.gitlab.arturbosch.detekt.api.ProjectExtensionKt.<clinit>(ProjectExtension.kt:20)
        ... 7 more


FAILURE: Build failed with an exception.

This is my build.gradle :


buildscript {
    repositories {
        jcenter()
    }
    dependencies {
        classpath "gradle.plugin.io.gitlab.arturbosch.detekt:detekt-gradle-plugin:1.0.0.RC6-4"
    }
}

apply plugin: "io.gitlab.arturbosch.detekt"

detekt {
    version = "1.0.0.RC6"
    defaultProfile {
        config = file("detekt.yml")
        filters = ".*/resources/.*,.*/build/.*"
    }
}


And if I run the same detektCheck with a JDK 8, it passes successfully.

Maybe I miss some --add-module parameter but I can't find any way to set it.

Any help will be appreciated !

@arturbosch
Copy link
Member

This seems to be related with #566 and #747.
Do you use Windows?

@samClarenc
Copy link
Author

Hello, thanx for your response,

Yes it seems to be the same stacktrace than #566 .

I use Ubuntu 16.

I will try with detekt 1.0.0.RC6-1 version to test if it works !

@samClarenc
Copy link
Author

It works with the version :

detekt {
    version = "1.0.0.RC6-4"
}

I think my main problem now is more a sonar-scanner one : I don't know the version of detekt that is embedded in the sonar-scanner : I still get the error when I run it.

It could be helpful if you have any idea about this. If I find something useful, I will update this ticket !

@samClarenc
Copy link
Author

OK my misunderstanding was that the sonar-scanner does not "embed" sonar-kotlin but calls the sonarqube server.

I updated the sonar-kotlin plugin in my sonar and it now works.

Thanks for your time, I close the ticket !

@arturbosch
Copy link
Member

Awesome that it worked out for you!

@arturbosch arturbosch added this to the RC7 milestone Apr 28, 2018
@lock
Copy link

lock bot commented Jun 20, 2019

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related topics.

@lock lock bot locked as resolved and limited conversation to collaborators Jun 20, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

2 participants