IntelliJ unable to import Gradle project due to dependency verification

Answered

Hi, 

I've been testing out an open-source project (https://github.com/Nike-Inc/cerberus) and I've had issues getting IntelliJ to properly import the Gradle configuration. 

When I import the project into IntelliJ the Gradle refresh fails with the error: 

Dependency verification failed for org.testng:testng:7.1.0
214 artifacts failed verification:...

What is odd is that I can successfully build the project from the terminal using ./gradlew clean build. 

I've been unable to reproduce this error outside of IntelliJ. I've also reached out to the team who maintains the project and they are not sure what the cause is. I know that the Gradle Dependency Verification feature is an incubating feature (it outputs that in the logs during the import) but it's also odd that it works on my terminal but not within IntelliJ. 

Here is a copy of my IntelliJ Gradle Config for the project in case it helps: 

 

My steps to reproduce are: 

1) Clone the Cerberus project from Github

2) Open IntelliJ 2020.1.3 Ultimate

3) Select 'Open or Import' 

4) Open the build.gradle file from the Cerberus project root directory. 

5) Select "Open as Project". 

At this point, the project will open and IntelliJ will begin to perform the Gradle Sync.  After a short while, the import will fail due to dependency verification failures. 

I have also attempted to run the command: 

gradle --write-verification-metadata sha256,sha1 help


Per the Gradle documentation but that didn't fix the issue either. I figured I'd ask here since I'm only seeing the error with IntelliJ. My "work around" is to simply delete the verification-metadata.xml file from the project (being careful not to commit that deletion) and IntelliJ successfully imports the project. 

Has anyone experienced this issue or similar?

Thanks!

0
5 comments

I get exactly the same error in both IntelliJ IDEA and the command line Gradle build when following your steps, so IDE behavior is consistent:

0
Avatar
Permanently deleted user

Thanks, after this I had few more colleagues try and it was a mixed bag, some failed in the IDE but not the terminal and others failed in both. I'll see if I can find the issue on the Gradle side. 

 

 

0
Avatar
Permanently deleted user

It happens for any project, where gradle/verification-metadata.xml file is present.

Steps to reproduce:

1) In IntelliJ create a new Java project with Gradle .

2) Sync the project to let it download all dependencies and Gradle distribution.

3) From terminal run the following in order to generate gradle/verification-metadata.xml file:

./gradlew --write-verification-metadata sha256 help

4) IntelliJ can no longer sync the project, failing with

Dependency verification failed for org.junit.jupiter:junit-jupiter-api:5.6.0
4 artifacts failed verification:
- apiguardian-api-1.1.0-sources.jar (org.apiguardian:apiguardian-api:1.1.0) from repository MavenRepo
- junit-jupiter-api-5.6.0-sources.jar (org.junit.jupiter:junit-jupiter-api:5.6.0) from repository MavenRepo
- junit-platform-commons-1.6.0-sources.jar (org.junit.platform:junit-platform-commons:1.6.0) from repository MavenRepo
- opentest4j-1.2.0-sources.jar (org.opentest4j:opentest4j:1.2.0) from repository MavenRepo
If the artifacts are trustworthy, you will need to update the gradle/verification-metadata.xml file by following the instructions at https://docs.gradle.org/6.7/userguide/dependency_verification.html#sec:troubleshooting-verification

Gradle still works from command line and can build the project.

0
Avatar
Permanently deleted user

Gradle Idea Module downloads sources by default and includes them as the dependencies. The checksums of sources are not included in verification-metadata.xml file therefore verification fails. A workaround is to include the following options in build.gradle:

plugins {
id 'idea'
}
idea {
module {
downloadJavadoc = false
downloadSources = false
}
}
0

Thanks for the information everyone.

I created a new bug report for this on our issue tracker: IDEA-258328. Developers will look into it shortly.

Feel free to leave additional comments and follow the issue for further updates from the dev team.

See this article if you are not familiar with YouTrack.

0

Please sign in to leave a comment.