简体   繁体   中英

IntelliJ IDEA using JavaScript “version” of dependency specified in Gradle build file?

This issue just recently (past couple days) started occurring on one of my development machines.

I'm using Eclipse's Vert.x dependency for a web project:

build.gradle

dependencies {
    ...
    // Kotlin
    compile "org.jetbrains.kotlin:kotlin-stdlib-jre8:$kotlin_version"
    // Vert.x for web framework
    compile group: 'io.vertx', name: 'vertx-core', version: '3.4.2'
    compile group: 'io.vertx', name: 'vertx-web', version: '3.4.2'
    ...
}

This has worked fine in the past - I think the triggering action was my upgrading to IntelliJ 2017.2.2, but now:

  1. IntelliJ cannot resolve any of the -web imports:

在此输入图像描述

  1. If I examine the Dependencies list for my Module, the JavaScript version of the dependency is shown?

How did this happen , and how can I make sure it's properly recognized as a Java dependency?

在此输入图像描述

Edit: Sample project available here: https://youtrack.jetbrains.com/issue/IDEA-177950

This is a bug in the Kotlin plugin which is fixed in version 1.1.4-2. After you update the plugin, you need to delete the incorrect libraries and reimport your project from Gradle to have your project fixed.

If you face such problems, the first two things you always can do is:

  1. (in IntellJ) File > Invalidate Caches/Restart
  2. (in IntellJ's Gradle Bar) Press button for Refresh all gradle dependencies

If this doesn't help, please check if ./gradlew clean testClasses succeeds or also fails with such an error.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM