我正在编写我的第一个春季启动应用程序。在运行以下命令时,我得到了例外。
spring init --build maven --groupId com.redhat.examples\ --version 1.0 --java-version 1.8 --dependencies web\ --name hola-springboot hola-springboot
java.lang.IllegalArgumentException: Only the target location may be specified
at org.springframework.util.Assert.isTrue(Assert.java:68)
at org.springframework.boot.cli.command.init.InitCommand$InitOptionHandler.createProjectGenerationRequest(InitCommand.java:218)
at org.springframework.boot.cli.command.init.InitCommand$InitOptionHandler.generateProject(InitCommand.java:209)
at org.springframework.boot.cli.command.init.InitCommand$InitOptionHandler.run(InitCommand.java:189)
at org.springframework.boot.cli.command.options.OptionHandler.run(OptionHandler.java:84)
at org.springframework.boot.cli.command.OptionParsingCommand.run(OptionParsingCommand.java:54)
at org.springframework.boot.cli.command.CommandRunner.run(CommandRunner.java:219)
at org.springframework.boot.cli.command.CommandRunner.runAndHandleErrors(CommandRunner.java:171)
at org.springframework.boot.cli.SpringCli.main(SpringCli.java:63)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.springframework.boot.loader.MainMethodRunner.run(MainMethodRunner.java:48)
at org.springframework.boot.loader.Launcher.launch(Launcher.java:87)
at org.springframework.boot.loader.Launcher.launch(Launcher.java:50)
at org.springframework.boot.loader.JarLauncher.main(JarLauncher.java:58)
答案 0 :(得分:2)
通过删除命令中的'\'s
并使用spring-cli版本1.4.1运行,我能够在Windows上成功运行它
spring init --build maven --groupId com.redhat.examples --version 1.0 --java-version 1.8 --dependencies web -- me hola-springboot hola-springboot Using service at start.spring.io Project extracted to '\Data\hola-springboot'
答案 1 :(得分:0)
当命令中有任何空格或无效字符时,会出现此错误。从命令中删除空格或无效字符