Skip to content

refreshVersions not working with flatDir repository #401

@ramartinroucek

Description

@ramartinroucek

🐛 Describe the bug

Gradle command refreshVersions is not working with gradle flatDir repository. This repository is used to target libraries locally from disk. Example of a such repository definition in build.gradle.kts:

    repositories {
        ..
        flatDir {
            dirs("${rootProject.projectDir}/libs/")
        }
    }

⚠️ Current behavior

The refreshVersion task tries to search for all dependencies even for the local libraries from "flatDir" repository which leads to following exception:

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':refreshVersions'.
> ModuleId(group=local-library, name=local-library) not found. Searched the following repositories:
  - https://repo.maven.apache.org/maven2/

Start of exception:

Caused by: java.util.NoSuchElementException: ModuleId(group=local-library, name=local-library) not found. Searched the following repositories:
- https://repo.maven.apache.org/maven2/

        at de.fayard.refreshVersions.core.internal.GettingVersionCandidatesKt.getVersionCandidates(GettingVersionCandidates.kt:75)
        at de.fayard.refreshVersions.core.internal.GettingVersionCandidatesKt$getVersionCandidates$8.invokeSuspend(GettingVersionCandidates.kt)
        at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
        at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:56)
        at kotlinx.coroutines.EventLoopImplBase.processNextEvent(EventLoop.common.kt:274)
        at kotlinx.coroutines.BlockingCoroutine.joinBlocking(Builders.kt:84)

✅ Expected behavior

There are two options how to solve this problem:

  1. Skip version lookup for libraries from flatDirs, because these libraries are not usually listed on public repositories.

  2. Instead of throwing exception just warn on standard output that the library could not be found. The old version of this plugin called "buildSrcVersions" behaves like this, it print out message like this:

Failed to determine the latest version for the following dependencies (use --info for details):
 - local-library

💣 Steps to reproduce

Create a flatDir repository with at least one library which is used as dependency.

Metadata

Metadata

Assignees

No one assigned

    Labels

    help wantedExtra attention is neededproblemSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions