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

Scan error - Illegal character in authority at index 7 for maven #1035

Open nagarajgond opened 9 months ago

nagarajgond commented 9 months ago

Describe the bug Illegal character in authority at index 7: file://C:\Users\username.m2\repository thrown when scanning maven project.

SBM Version spring-boot-migrator v0.15.0 Java OpenJDK 17

SBM Application spring-boot-migrator scan

To Reproduce Steps to reproduce the behavior:

  1. scan maven project

Stacktrace scanning 'C:/user/workspace/proj1'

Checked preconditions for 'C:\user\workspace\proj1' [ok] Found pom.xml. [ok] 'sbm.gitSupportEnabled' is 'true', changes will be committed to branch [ftr-proj] after each recipe. [ok] Required Java version (17) was found. [ok] Found required source dir 'src/main/java'.

Maven 0% │████████▌ │ 1/4 (0:00:00 / 0:00:00) Illegal character in authority at index 7: file://C:\Users\user.m2\repository Details of the error have been omitted. You can use the stacktrace command to print the full stacktrace. Maven 100% │██████████████████████████████████│ 8/8 (0:00:01 / 0:00:00) migrator:> stacktrace java.lang.IllegalArgumentException: Illegal character in authority at index 7: file://C:\Users\user.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.resolveDependencies(ResolvedPom.java:579) 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)

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.

bvanhaute commented 9 months ago

same error: Maven 0% │██████████████████████████████████│ 1/1 (0:00:00 / 0:00:00) Illegal character in authority at index 7: file://C:\Users\removed_my_username.m2\repository/org/springframework/boot/spring-boot-starter-parent/3.2.2/spring-boot-starter-parent-3.2.2.pom on windows 10 , spring boot migrator version 0.15.0

FredyDevJava commented 8 months ago

same issue: Caused by: java.net.URISyntaxException: Illegal character in authority at index 7: file://C:\Users\my_username.m2\repository/maven/maven-parent/5.11.20/maven-parent-5.11.20.pom at java.base/java.net.URI$Parser.fail(URI.java:2976) at java.base/java.net.URI$Parser.parseAuthority(URI.java:3310) at java.base/java.net.URI$Parser.parseHierarchical(URI.java:3221) at java.base/java.net.URI$Parser.parse(URI.java:3177) at java.base/java.net.URI.(URI.java:623) at java.base/java.net.URI.create(URI.java:904)

Windows 10 Entreprise JDK 17 Maven 3.8.7

VishnuGurudathan commented 6 months ago

Same issue :

Is this related to an issue with windows ? Also keen to know if Struts to Spring Boot migration is supported in SBM.

Checked preconditions for 'D:\test\struts2spring-testing\struts\struts2-project-master' [ok] Found pom.xml. [ok] 'sbm.gitSupportEnabled' is 'true', changes will be committed to branch [master] after each recipe. [ok] Required Java version (17) was found. [ok] Found required source dir 'src/main/java'.

Maven 0% │██████████████████████████████████│ 0/1 (0:00:00 / 0:00:00) Illegal character in authority at index 7: file://C:\Users\user.m2\repository/org/apache/struts/struts2-core/2.5.10.1/struts2-core-2.5.10.1.pom Details of the error have been omitted. You can use the stacktrace command to print the full stacktrace. Maven 100% │██████████████████████████████████│ 2/2 (0:00:01 / 0:00:00)

migrator:> stacktrace java.lang.IllegalArgumentException: Illegal character in authority at index 7: file://C:\Users\user.m2\repository/org/apache/struts/struts2-core/2.5.10.1/struts2-core-2.5.10.1.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.resolveDependencies(ResolvedPom.java:579) 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)

wladimiresposito commented 6 months ago

same issue: But when I use version 0.14.0 the issue doesn't happen. What has changed and where has it changed since version 014.0 to 015.0?