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
431 stars 87 forks source link

Path issues on Windows machines #942

Closed ammachado closed 9 months ago

ammachado commented 10 months ago

Describe the bug Running the tool on a Windows machine fails because of a java.net.URISyntaxException: Illegal character in authority at index 7: file://C:\Users\ammachado.m2\repository

SBM Version Release 0.15

SBM Application spring-boot-upgrade.jar

To Reproduce Steps to reproduce the behavior:

  1. Run "java -jar C:\work\tools\spring-boot-upgrade.jar c:\work\projects\project-to-migrate"
  2. See error

Expected behavior Upgrade application should start.

Screenshots If applicable, add screenshots to help explain your problem.

Stacktrace

12:49:13.878 [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: java.lang.IllegalArgumentException: Illegal character in authority at index 7: file://C:\Users\ammachado\.m2\repository
        at java.base/java.net.URI.create(URI.java:906)
        at org.openrewrite.maven.internal.MavenPomDownloader.downloadMetadata(MavenPomDownloader.java:211)
        at org.openrewrite.maven.internal.MavenPomDownloader.datedSnapshotVersion(MavenPomDownloader.java:579)
        at org.openrewrite.maven.internal.MavenPomDownloader.download(MavenPomDownloader.java:477)
        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$Resolver.resolve(ResolvedPom.java:299)
        at org.openrewrite.maven.tree.ResolvedPom.resolve(ResolvedPom.java:144)
        at org.openrewrite.maven.tree.Pom.resolve(Pom.java:104)
        at org.openrewrite.maven.MavenParser.parseInputs(MavenParser.java:122)
        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.SpringBootMigratorRunner.run(SpringBootMigratorRunner.java:48)
        at org.springframework.boot.SpringApplication.callRunner(SpringApplication.java:762)
        ... 13 common frames omitted
Caused by: java.net.URISyntaxException: Illegal character in authority at index 7: file://C:\Users\ammachado\.m2\repository
        at java.base/java.net.URI$Parser.fail(URI.java:2976)
        at java.base/java.net.URI$Parser.parseAuthority(URI.java:3325)
        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)
        ... 28 common frames omitted

Example Source code to replicate the issue (Optional) It would help us immensely if we were to have an example test source code or a snippet where you can see this problem, you could attach a zip file along with this issue.

Although this section is optional, it would speed up our process of providing a fix. P.S. Please remove any sensitive data and do not upload any proprietary source.

Desktop (please complete the following information):

Additional context Add any other context about the problem here.

anthonyCarigny commented 10 months ago

I have the same issue

enermax626 commented 9 months ago

Same issue here.

fabapp2 commented 9 months ago

Hi @ammachado @enermax626 @anthonyCarigny thanks for reporting 🚀

957 should fix this.

Testing against Windows is a bit tricky for me. Could you please try against the latest main branch?

pappnase99 commented 8 months ago

Just ran into this on my Windows machine. So is there a release including this fix?

JOpsDev commented 5 months ago

Compiled todays version from main and ran into the exact same problem again. It takes considerably longer until this error appears but utltimately it's the exact same stack trace.

jagdevsingh9709 commented 5 months ago

I am also facing the same issue. I just downloaded the latest spring boot migrator jar file and executed it against my project. below is the stacktrace. can someone please help me with this issue.

java.lang.IllegalArgumentException: Illegal character in authority at index 9: file://C:\Users\jagdev.singh\.m2\repository at java.base/java.net.URI.create(URI.java:932) at org.openrewrite.maven.internal.MavenPomDownloader.downloadMetadata(MavenPomDownloader.java:211) at org.openrewrite.maven.internal.MavenPomDownloader.datedSnapshotVersion(MavenPomDownloader.java:579) at org.openrewrite.maven.internal.MavenPomDownloader.download(MavenPomDownloader.java:477) 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$Resolver.resolve(ResolvedPom.java:299) at org.openrewrite.maven.tree.ResolvedPom.resolve(ResolvedPom.java:144) at org.openrewrite.maven.tree.Pom.resolve(Pom.java:104) at org.openrewrite.maven.MavenParser.parseInputs(MavenParser.java:122) 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)

hclhelio commented 4 months ago

Hello! Thanks for the Project!

I inform you that I downloaded the latest version (https://codeload.github.com/spring-projects-experimental/sspring-boot-migor/zip/refs/tags/0.15.1).

I did the Build with the Command 'mvn clean package' on Windows 11, Java 17 and with Maven 3.8.6 and Tried to Execute The Migrator with the Command:

java -java -ja-add-ons java.base/sun.nio.ch = all-unamed--add-opens java.base/java.io = all-unnanamed spring-up-upgrade.jar c: \ hcl .Helio \ gitlab \ arq \ backend \ branches \ spring-boot3 \ xpto-framework

So i get the same error reported by de others:

......... Find us on GitHub: https://via.vmw.com/8AD63p Please report all errors: https://via.vmw.com/bXlqJC

Scanning C:\hcl.helio\gitlab\arq\backend\branches\spring-boot3\xpto-framework 13:46:58.468 [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: java.lang.IllegalArgumentException: Illegal character in authority at index 7: file://C:\Users\uxxxxxx.m2\repository/org/springframework/boot/spring-boot-starter-parent/2.7.18/spring-boot-starter-parent-2.7.18.pom .........

The "spring-boot-starter-parent" is parent of my project, but i'm care. :).

So, i think that SMB try location the parent and so getting this erro.