Gangmax Blog

IntelliJ IDEA: "broken source path error" of Gradle project

One Gradle project in my IntelliJ IDEA IDE reports the following error:

1
Library Gradle: xxx(library jar name) has broken sources path: ...(library jar path)

However I can run “gradle” command to build the project successfully in command line.

Google and the the answer here.

The steps how to fix it:

  1. In IntelliJ IDEA, go to “View -> Tool Window”, click the “Gradle” item. The “Gradle” tool window will be shown.

  2. In the “Gradle” tool window, click the “Refresh” button. The IDE will refresh all the dependencies.

Here are two other issues I met recently with Gradle:

  • Gradle

When you run the “gradle clean build” command and get error, you can try the “./gradlew clean build” command. The difference is that the “gradlew” command will download the specific Gradle version defined in this project(in the “gradle/wrapper/gradle-wrapper.properties” file) to execute, while the “gradle” command will use the Gradle version of your local environment. They may be different and cause the building issue.

  • Gradle in IntelliJ IDEA, the “org.jetbrains.plugins.gradle.tooling.util.ModuleComponentIdentifierImpl.getModuleIdentifier()” error

When I built a local Gradle project, I got the “org.jetbrains.plugins.gradle.tooling.util.ModuleComponentIdentifierImpl.getModuleIdentifier()” error. I found the answer here: I upgraded my IntelliJ IDEA from “2018.1” to “2019.2.1”(Ultimate Edition), and then the error gone. So that’s an issue in IntelliJ IDEA old version.

Comments