Skip to content

Spring Boot Migrator App does not work correctly if a Maven project uses a version range in the declared parent project #1040

Open
@yellow-straw-hat

Description

@yellow-straw-hat

Describe the bug
When scanning a project using java -jar spring-boot-migrator.jar I got the following error:

scanmigrator:> scan /root/workspace/log_manager

scanning '/root/workspace/log_manager'

Checked preconditions for '/root/workspace/log_manager'
[ok] Found pom.xml.
[ok] 'sbm.gitSupportEnabled' is 'true', changes will be committed to branch [jdk17-spring3] after each recipe.
[ok] Required Java version (17) was found.
[ok] Found required source dir 'src/main/java'.


Maven        100% │██████████████████████████████████│ 2/2 (0:00:01 / 0:00:00) Illegal character in path at index 56: file:///root/.m2/repository/com/company/parent-project/[1.20.0,1.99]/parent-project-[1.20.0,1.99].pom
Details of the error have been omitted. You can use the stacktrace command to print the full stacktrace.

SBM Version

https://github.com/spring-projects-experimental/spring-boot-migrator/releases/tag/0.15.0

SBM Application
spring-boot-migrator.jar

To Reproduce
Steps to reproduce the behavior:

The project is inheriting from a parent project. and it's using a version range as follows:

    <parent>
        <groupId>com.company</groupId>
        <artifactId>parent-project</artifactId>
        <version>[1.20.0,1.99]</version>
    </parent>
    <artifactId>log-manager</artifactId>
    <version>1.21.0-SNAPSHOT</version>
    <name>log-manager</name>
    <description>Log Manager API</description>

Expected behavior
Expected to display the applicable recipes

Screenshots

Stacktrace

migrator:> stacktrace
java.lang.IllegalArgumentException: Illegal character in path at index 56: file:///root/.m2/repository/com/company/parent-project/[1.20.0,1.99]/parent-project-[1.20.0,1.99].pom
        at java.base/java.net.URI.create(URI.java:906)
        at org.openrewrite.maven.internal.MavenPomDownloader.download(MavenPomDownloader.java:487)
        at org.openrewrite.maven.tree.ResolvedPom$Resolver.resolveParentPropertiesAndRepositoriesRecursively(ResolvedPom.java:353)
        at org.openrewrite.maven.tree.ResolvedPom$Resolver.resolveParentsRecursively(ResolvedPom.java:310)
        at org.openrewrite.maven.tree.ResolvedPom.resolveDependencies(ResolvedPom.java:586)
        at org.openrewrite.maven.tree.ResolvedPom.resolveDependencies(ResolvedPom.java:502)
        at org.openrewrite.maven.tree.MavenResolutionResult.resolveDependencies(MavenResolutionResult.java:179)
        at org.openrewrite.maven.MavenParser.parseInputs(MavenParser.java:124)
        at org.springframework.sbm.build.impl.RewriteMavenParser.parseInputs(RewriteMavenParser.java:92)
        at org.springframework.sbm.project.parser.MavenProjectParser.parse(MavenProjectParser.java:94)
        at org.springframework.sbm.project.parser.ProjectContextInitializer.initProjectContext(ProjectContextInitializer.java:52)
        at org.springframework.sbm.engine.commands.ScanCommand.execute(ScanCommand.java:70)
        at org.springframework.sbm.shell.ScanShellCommand.scan(ScanShellCommand.java:67)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
        at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.base/java.lang.reflect.Method.invoke(Method.java:568)
        at org.springframework.shell.command.invocation.InvocableShellMethod.doInvoke(InvocableShellMethod.java:306)
        at org.springframework.shell.command.invocation.InvocableShellMethod.invoke(InvocableShellMethod.java:232)
        at org.springframework.shell.command.CommandExecution$DefaultCommandExecution.evaluate(CommandExecution.java:160)
        at org.springframework.shell.Shell.evaluate(Shell.java:208)
        at org.springframework.shell.Shell.run(Shell.java:140)
        at org.springframework.shell.jline.InteractiveShellRunner.run(InteractiveShellRunner.java:73)
        at org.springframework.shell.DefaultShellApplicationRunner.run(DefaultShellApplicationRunner.java:65)
        at org.springframework.boot.SpringApplication.callRunner(SpringApplication.java:762)
        at org.springframework.boot.SpringApplication.callRunners(SpringApplication.java:752)
        at org.springframework.boot.SpringApplication.run(SpringApplication.java:315)
        at org.springframework.boot.SpringApplication.run(SpringApplication.java:1306)
        at org.springframework.boot.SpringApplication.run(SpringApplication.java:1295)
        at org.springframework.sbm.SpringShellApplication.main(SpringShellApplication.java:27)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
        at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.base/java.lang.reflect.Method.invoke(Method.java:568)
        at org.springframework.boot.loader.MainMethodRunner.run(MainMethodRunner.java:49)
        at org.springframework.boot.loader.Launcher.launch(Launcher.java:108)
        at org.springframework.boot.loader.Launcher.launch(Launcher.java:58)
        at org.springframework.boot.loader.JarLauncher.main(JarLauncher.java:65)
Caused by: java.net.URISyntaxException: Illegal character in path at index 56: file:///root/.m2/repository/com/company/parent-project/[1.20.0,1.99]/parent-project-[1.20.0,1.99].pom
        at java.base/java.net.URI$Parser.fail(URI.java:2976)
        at java.base/java.net.URI$Parser.checkChars(URI.java:3147)
        at java.base/java.net.URI$Parser.parseHierarchical(URI.java:3229)
        at java.base/java.net.URI$Parser.parse(URI.java:3177)
        at java.base/java.net.URI.<init>(URI.java:623)
        at java.base/java.net.URI.create(URI.java:904)

Desktop (please complete the following information):

  • OS: Ubuntu 20.04 under WSL 2
    Additional context
    Add any other context about the problem here.
    I tried to use a fixed version. But nothing has changed, still getting the error, it's like the migrator app is using some sort of uncleaned cache ..

Metadata

Metadata

Assignees

No one assigned

    Labels

    type: bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions