You need to enable JavaScript to run this app.
最新活动
大模型
产品
解决方案
定价
生态与合作
支持与服务
开发者
了解我们

Spring Boot项目执行mvnw spring-boot:run报错,调整启动参数引号写法后才生效的问题咨询

Spring Boot项目执行mvnw spring-boot:run报错,调整启动参数引号写法后才生效的问题咨询

大家好,最近我跟着Spring的官方指南做「Consuming a RESTful Web Service」项目时碰到了一个棘手的问题,想过来请教下各位大佬:

  • 最开始我在IntelliJ的终端里执行启动命令:./mvnw spring-boot:run,结果直接报错了
  • 我怀疑是自己写的代码有问题,就把官方提供的完整项目克隆到本地(对应目录是gs-consuming-rest/complete),但运行同样的启动命令还是报相同的错误:

[ERROR] Failed to execute goal org.springframework.boot:spring-boot-maven-plugin:3.3.0:run (default-cli) on project consuming-rest-complete: Process terminated with exit code: 1 -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.springframework.boot:spring-boot-maven-plugin:3.3.0:run (default-cli) on project consuming-rest-complete: Process terminated with exit code: 1

后来我看到有建议说换个端口试试,就执行了这条命令:./mvnw spring-boot:run -Dspring-boot.run.arguments="--server.port=8081",结果还是不行。

最后我尝试了另一种写法——先启动了quoters项目,再执行这条命令:./mvnw spring-boot:run "-Dspring-boot.run.arguments=--server.port=8081",这次居然成功运行了!核心区别就是把整个-Dspring-boot.run.arguments=--server.port=8081参数用双引号括了起来。

我有点搞不懂为什么两种引号的写法会有这么大的差异,有没有大佬能帮忙解释下这个问题呀?

内容来源于stack exchange

火山引擎 最新活动