spring-projects-experimental / spring-boot-migrator

Spring Boot Migrator (SBM) is a tool for automated code migrations to upgrade or migrate to Spring Boot
Apache License 2.0
451 stars 89 forks source link

Local repository is not tried when downloading dependencies, failing download #1047

Open cfecherolle opened 4 months ago

cfecherolle commented 4 months ago

Describe the bug When scanning my project, the Maven part fails because of one the dependencies cannot be downloaded. This dependency is defined in the multiplatform/lib folder of my project which I'm using as a local repository, and defining like so in my pom.xml:

        <repository>
            <id>multiplatform-local-repository</id>
            <url>file://${project.basedir}/multiplatform/lib/</url>
        </repository>

When building with Maven as I usually do, this works fine, but for some reason the scan does not pick it up as a valid location to find dependencies, it tries other repositories (Maven Central + my other remote repositories definitions) and thus, fails to download the specific dependency from my local repository.

SBM Version 0.15.0

SBM Application spring-boot-upgrade.jar

To Reproduce Steps to reproduce the behavior:

  1. Define a pom.xml with a local repository definition like my example above
  2. Create the corresponding folder and Maven nested repository structure and put a dependency (JAR + POM) in it
  3. Declare it as a dependency
  4. Scan the project with spring-boot-upgrade.jar

Expected behavior All dependencies should be downloaded, including the one from the local repository.

Stacktrace

Caused by: org.openrewrite.maven.MavenDownloadingExceptions
    at org.openrewrite.maven.MavenDownloadingExceptions.append(MavenDownloadingExceptions.java:47)
    at org.openrewrite.maven.tree.MavenResolutionResult.resolveDependencies(MavenResolutionResult.java:184)
    at org.openrewrite.maven.MavenParser.parseInputs(MavenParser.java:124)
    ... 19 more
    Suppressed: org.openrewrite.maven.MavenDownloadingException: Unable to download POM. Tried repositories:
https://jitpack.io: HTTP 404
https://repo.maven.apache.org/maven2: HTTP 404
        at org.openrewrite.maven.internal.MavenPomDownloader.download(MavenPomDownloader.java:561)
        at org.openrewrite.maven.tree.ResolvedPom.resolveDependencies(ResolvedPom.java:579)
        at org.openrewrite.maven.tree.ResolvedPom.resolveDependencies(ResolvedPom.java:502)
        at org.openrewrite.maven.tree.MavenResolutionResult.resolveDependencies(MavenResolutionResult.java:179)
        ... 20 more

Desktop (please complete the following information):

gwynlionhart commented 2 months ago

Chiming in to say the same happens for me. Some manner of flag to check local repos, or just automatically check for them when the pom.xml mentions them, would be nice.