Gradle command line build OK, IntelliJ stuck looking for stale dependency version


When i compile, build, deploy my gradle project from the command line everything is ok.

However, IntelliJ compilation fails. The error indicates IntelliJ is looking for a specific dated snapshot version of a dependency, not just the snapshot version specified in build.gradle.

From build.gradle:

// container provided libraries
compileOnly 'log4j:log4j:1.2.17@jar',



Could not find util.document-1.3.3570-SNAPSHOT.jar (net.careweb:util.document:1.3.3570-SNAPSHOT:20211011.140734-2).
Searched in the following locations:


The jar it should find is in the .m2 repo as util.document-1.3.3570-SNAPSHOT.jar

How do i fix this?



评论操作 固定链接

How did you install that snapshot version?

May be related to It would be nice to confirm this. Is it possible to get a reproducible project?

评论操作 固定链接

The snapshot version is from a another locally built gradle project. So it is functionally the same setup as the link you posted, but in our case IntelliJ is only looking for the one version, not for all historic versions. I cannot send you the projects because they are work projects.

评论操作 固定链接

Here is the similar issue: IDE Gradle integration is searching for dated version instead of SNAPSHOT version in the local repository:

How do you publish them to Maven local repository? Do they have xml metadata information?


Please try if it helps to enable the Settings (Preferences on macOS) | Build, Execution, Deployment | Build Tools | Maven | 'Always update snapshots' option.

Please also try the 'Refresh Gradle dependencies' action: in Gradle tool window. If you use Gradle version less than 6 please try also this suggestion

Please attach IDE logs zipped (use Help | Collect Logs and Diagnostic Data action to gather them), I will check them if there are any suspicions messages. For uploading you can use or any file sharing service. Thanks.

评论操作 固定链接

Thank you Andrey, your first advice to check 'Always update snapshots' fixed part of the problem. The project now builds inside IntelliJ.

However, it 'cannot' find all the dependencies, but they are all there including the xml metadata (maven-metadata-local.xml).

That is, obviously the dependencies are found, otherwise the build would fail, but some dependencies are not listed in 'External Libraries' and show up as red markings all over the code. The missing dependencies are mentioned in the logs, example:

2021-09-30 15:06:07,995 [178965992] INFO - .packagesearch.intellij-plugin - [116, source=DATA_CHANGED] ProjectDataProvider#fetchInfoFor() — Failed obtaining data for 15 dependencies:
* ''
* 'net.careweb:legacy.dao'

I have tried:

./gradlew --refresh-dependencies -x checkstyleMain build

This builds the project but does not solve the problem of missing dependencies.

评论操作 固定链接

I have uploaded the log files, maybe you can find the cause.

评论操作 固定链接

Hi Andrey, no need to go through the logs, this solution worked:

(refreshing gradle dependecies by right-clicking the project in the gradle-window > Refresh Gradle Dependencies)

评论操作 固定链接

Thanks for the information!