SpringBoot启动方式

在使用SpringBoot进行微服务集群开发时,本地启动多个服务可能会遇到使用Powershell窗口启动服务失败的问题。本文详细记录了在Windows环境下,尝试使用mvn spring-boot:run命令启动Eureka服务节点时出现的错误及解决过程。通过对比发现,直接使用cmd窗口启动服务则能成功避免该问题。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

我们在做SpringBoot项目开发的时候,特别是微服务集群开发,本地是需要启动多个服务的,这个时候就有多种方式可以选择了,可以在终端上启动,也可以在IDEA等IDE中启动,这里说说使用的方式,在使用前先说个坑,在Win开发环境时,使用了Win的Powershell窗口使用mvn spring-boot:run -Dspring.profiles.active=peer的方式启动一个节点服务,始终报错,

[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building eureka-server 0.0.1-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 0.270 s
[INFO] Finished at: 2019-02-18T23:52:16+08:00
[INFO] Final Memory: 11M/245M
[INFO] ------------------------------------------------------------------------
[ERROR] Unknown lifecycle phase ".profiles.active=peer". You must specify a valid lifecycle phase or a goal in the format <plugin-prefix>:<goal> or <plugin-group-id>:<plugin-artifact-id>[:<plugin-version>]:<goal>. Available lifecycle phases are: validate, initialize, generate-sources, process-sources, generate-resources, process-resources, compile, process-classes, generate-test-sources, process-test-sources, generate-test-resources, process-test-resources, test-compile, process-test-classes, test, prepare-package, package, pre-integration-test, integration-test, post-integration-test, verify, install, deploy, pre-clean, clean, post-clean, pre-site, site, post-site, site-deploy. -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/LifecyclePhaseNotFoundException

而且这里怎么就扯到maven的lifecycle?研究了很久,简直莫名其妙,然后好奇试了下直接使用cmd窗口启动,启动成功了,最后得出的结论就是没事不要使用Powershell,简直浪费时间。下面我们来说说Spring Boot启动的方式。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值