Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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 opened this issue Mar 25, 2024 · 3 comments
Labels
type: bug Something isn't working

Comments

@yellow-straw-hat
Copy link

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 ..
@yellow-straw-hat yellow-straw-hat added the type: bug Something isn't working label Mar 25, 2024
@cikichen
Copy link

18:34:50.303 [main] ERROR o.s.boot.SpringApplication - Application run failed
java.lang.IllegalStateException: Failed to execute ApplicationRunner
	at org.springframework.boot.SpringApplication.callRunner(SpringApplication.java:765)
	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.SpringBootUpgradeReportApp.main(SpringBootUpgradeReportApp.java:31)
	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: org.springframework.sbm.engine.recipe.ActionFailedException: Action [SpringBootUpgradeReportAction] 'Creates a Upgrade report for Spring Boot 3.' failed: Cannot invoke "String.startsWith(String)" because the return value of "org.springframework.sbm.build.api.Dependency.getVersion()" is null
	at org.springframework.sbm.engine.recipe.Action.applyWithStatusEvent(Action.java:43)
	at org.springframework.sbm.engine.recipe.Recipe.apply(Recipe.java:101)
	at org.springframework.sbm.engine.commands.ApplyCommand.execute(ApplyCommand.java:69)
	at org.springframework.sbm.SpringBootMigratorRunner.run(SpringBootMigratorRunner.java:50)
	at org.springframework.boot.SpringApplication.callRunner(SpringApplication.java:762)
	... 13 common frames omitted
Caused by: java.lang.NullPointerException: Cannot invoke "String.startsWith(String)" because the return value of "org.springframework.sbm.build.api.Dependency.getVersion()" is null
	at org.springframework.sbm.boot.common.conditions.HasSpringBootDependencyImport.resolveCoordinates(HasSpringBootDependencyImport.java:56)
	at org.springframework.sbm.boot.common.conditions.HasSpringBootDependencyImport.lambda$hasBuildFileDependencyImport$0(HasSpringBootDependencyImport.java:49)
	at java.base/java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:197)
	at java.base/java.util.ArrayList$ArrayListSpliterator.tryAdvance(ArrayList.java:1602)
	at java.base/java.util.stream.ReferencePipeline.forEachWithCancel(ReferencePipeline.java:129)
	at java.base/java.util.stream.AbstractPipeline.copyIntoWithCancel(AbstractPipeline.java:527)
	at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:513)
	at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:499)
	at java.base/java.util.stream.MatchOps$MatchOp.evaluateSequential(MatchOps.java:230)
	at java.base/java.util.stream.MatchOps$MatchOp.evaluateSequential(MatchOps.java:196)
	at java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
	at java.base/java.util.stream.ReferencePipeline.anyMatch(ReferencePipeline.java:632)
	at org.springframework.sbm.boot.common.conditions.HasSpringBootDependencyImport.hasBuildFileDependencyImport(HasSpringBootDependencyImport.java:50)
	at java.base/java.util.stream.MatchOps$1MatchSink.accept(MatchOps.java:90)
	at java.base/java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:197)
	at java.base/java.util.ArrayList$ArrayListSpliterator.tryAdvance(ArrayList.java:1602)
	at java.base/java.util.stream.ReferencePipeline.forEachWithCancel(ReferencePipeline.java:129)
	at java.base/java.util.stream.AbstractPipeline.copyIntoWithCancel(AbstractPipeline.java:527)
	at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:513)
	at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:499)
	at java.base/java.util.stream.MatchOps$MatchOp.evaluateSequential(MatchOps.java:230)
	at java.base/java.util.stream.MatchOps$MatchOp.evaluateSequential(MatchOps.java:196)
	at java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
	at java.base/java.util.stream.ReferencePipeline.anyMatch(ReferencePipeline.java:632)
	at org.springframework.sbm.boot.common.conditions.HasSpringBootDependencyImport.evaluate(HasSpringBootDependencyImport.java:44)
	at org.springframework.sbm.boot.common.conditions.IsSpringBootProject.evaluate(IsSpringBootProject.java:46)
	at org.springframework.sbm.boot.upgrade_27_30.report.helper.IsSpring27Or30ProjectHelper.evaluate(IsSpring27Or30ProjectHelper.java:43)
	at org.springframework.sbm.boot.upgrade_27_30.report.SpringBootUpgradeReportSection.shouldRender(SpringBootUpgradeReportSection.java:99)
	at org.springframework.sbm.boot.upgrade_27_30.report.SpringBootUpgradeReportAction.lambda$apply$0(SpringBootUpgradeReportAction.java:124)
	at java.base/java.util.stream.ReferencePipeline$2$1.accept(ReferencePipeline.java:178)
	at java.base/java.util.ArrayList$ArrayListSpliterator.forEachRemaining(ArrayList.java:1625)
	at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:509)
	at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:499)
	at java.base/java.util.stream.ForEachOps$ForEachOp.evaluateSequential(ForEachOps.java:150)
	at java.base/java.util.stream.ForEachOps$ForEachOp$OfRef.evaluateSequential(ForEachOps.java:173)
	at java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
	at java.base/java.util.stream.ReferencePipeline.forEach(ReferencePipeline.java:596)
	at org.springframework.sbm.boot.upgrade_27_30.report.SpringBootUpgradeReportAction.apply(SpringBootUpgradeReportAction.java:125)
	at org.springframework.sbm.boot.upgrade_27_30.report.SpringBootUpgradeReportAction.applyInternal(SpringBootUpgradeReportAction.java:214)
	at org.springframework.sbm.engine.recipe.Action.applyWithStatusEvent(Action.java:37)
	... 17 common frames omitted
Failed to execute ApplicationRunner
java.lang.IllegalStateException: Failed to execute ApplicationRunner
	at org.springframework.boot.SpringApplication.callRunner(SpringApplication.java:765)
	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.SpringBootUpgradeReportApp.main(SpringBootUpgradeReportApp.java:31)
	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: org.springframework.sbm.engine.recipe.ActionFailedException: Action [SpringBootUpgradeReportAction] 'Creates a Upgrade report for Spring Boot 3.' failed: Cannot invoke "String.startsWith(String)" because the return value of "org.springframework.sbm.build.api.Dependency.getVersion()" is null
	at org.springframework.sbm.engine.recipe.Action.applyWithStatusEvent(Action.java:43)
	at org.springframework.sbm.engine.recipe.Recipe.apply(Recipe.java:101)
	at org.springframework.sbm.engine.commands.ApplyCommand.execute(ApplyCommand.java:69)
	at org.springframework.sbm.SpringBootMigratorRunner.run(SpringBootMigratorRunner.java:50)
	at org.springframework.boot.SpringApplication.callRunner(SpringApplication.java:762)
	... 13 more
Caused by: java.lang.NullPointerException: Cannot invoke "String.startsWith(String)" because the return value of "org.springframework.sbm.build.api.Dependency.getVersion()" is null
	at org.springframework.sbm.boot.common.conditions.HasSpringBootDependencyImport.resolveCoordinates(HasSpringBootDependencyImport.java:56)
	at org.springframework.sbm.boot.common.conditions.HasSpringBootDependencyImport.lambda$hasBuildFileDependencyImport$0(HasSpringBootDependencyImport.java:49)
	at java.base/java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:197)
	at java.base/java.util.ArrayList$ArrayListSpliterator.tryAdvance(ArrayList.java:1602)
	at java.base/java.util.stream.ReferencePipeline.forEachWithCancel(ReferencePipeline.java:129)
	at java.base/java.util.stream.AbstractPipeline.copyIntoWithCancel(AbstractPipeline.java:527)
	at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:513)
	at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:499)
	at java.base/java.util.stream.MatchOps$MatchOp.evaluateSequential(MatchOps.java:230)
	at java.base/java.util.stream.MatchOps$MatchOp.evaluateSequential(MatchOps.java:196)
	at java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
	at java.base/java.util.stream.ReferencePipeline.anyMatch(ReferencePipeline.java:632)
	at org.springframework.sbm.boot.common.conditions.HasSpringBootDependencyImport.hasBuildFileDependencyImport(HasSpringBootDependencyImport.java:50)
	at java.base/java.util.stream.MatchOps$1MatchSink.accept(MatchOps.java:90)
	at java.base/java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:197)
	at java.base/java.util.ArrayList$ArrayListSpliterator.tryAdvance(ArrayList.java:1602)
	at java.base/java.util.stream.ReferencePipeline.forEachWithCancel(ReferencePipeline.java:129)
	at java.base/java.util.stream.AbstractPipeline.copyIntoWithCancel(AbstractPipeline.java:527)
	at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:513)
	at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:499)
	at java.base/java.util.stream.MatchOps$MatchOp.evaluateSequential(MatchOps.java:230)
	at java.base/java.util.stream.MatchOps$MatchOp.evaluateSequential(MatchOps.java:196)
	at java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
	at java.base/java.util.stream.ReferencePipeline.anyMatch(ReferencePipeline.java:632)
	at org.springframework.sbm.boot.common.conditions.HasSpringBootDependencyImport.evaluate(HasSpringBootDependencyImport.java:44)
	at org.springframework.sbm.boot.common.conditions.IsSpringBootProject.evaluate(IsSpringBootProject.java:46)
	at org.springframework.sbm.boot.upgrade_27_30.report.helper.IsSpring27Or30ProjectHelper.evaluate(IsSpring27Or30ProjectHelper.java:43)
	at org.springframework.sbm.boot.upgrade_27_30.report.SpringBootUpgradeReportSection.shouldRender(SpringBootUpgradeReportSection.java:99)
	at org.springframework.sbm.boot.upgrade_27_30.report.SpringBootUpgradeReportAction.lambda$apply$0(SpringBootUpgradeReportAction.java:124)
	at java.base/java.util.stream.ReferencePipeline$2$1.accept(ReferencePipeline.java:178)
	at java.base/java.util.ArrayList$ArrayListSpliterator.forEachRemaining(ArrayList.java:1625)
	at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:509)
	at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:499)
	at java.base/java.util.stream.ForEachOps$ForEachOp.evaluateSequential(ForEachOps.java:150)
	at java.base/java.util.stream.ForEachOps$ForEachOp$OfRef.evaluateSequential(ForEachOps.java:173)
	at java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
	at java.base/java.util.stream.ReferencePipeline.forEach(ReferencePipeline.java:596)
	at org.springframework.sbm.boot.upgrade_27_30.report.SpringBootUpgradeReportAction.apply(SpringBootUpgradeReportAction.java:125)
	at org.springframework.sbm.boot.upgrade_27_30.report.SpringBootUpgradeReportAction.applyInternal(SpringBootUpgradeReportAction.java:214)
	at org.springframework.sbm.engine.recipe.Action.applyWithStatusEvent(Action.java:37)
	... 17 more

@Shashank1816
Copy link

I'm also facing the same error ... can someone help @fabapp2 ?

@winadm1n
Copy link

I am also facing the same error please help us @fabapp2

[main] ERROR o.s.boot.SpringApplication - Application run failed

Caused by: org.openrewrite.internal.RecipeRunException: Exception while visiting project file '/runner/_work/email_service-api-services-poc/email_service-api-services-poc/application/src/main/java/FlowConfigurations.java (in FlowConfiguration.responsys_auth_system_api_client_flow)', caused by: java.lang.NullPointerException: Cannot invoke "org.openrewrite.java.tree.JRightPadded.getElement()" because "l" is null, at org.openrewrite.java.tree.JRightPadded.getElements(JRightPadded.java:106)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants