报错日志如下
Identify and stop the process that's listening on port 8080 or configure this application to listen on another port.
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 4.469 s
[INFO] Finished at: 2022-01-19T21:22:06+08:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.springframework.boot:spring-boot-maven-plugin:2.6.2:run (default-cli) on project demo: Application finished with exit code: 1 -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.springframework.boot:spring-boot-maven-plugin:2.6.2:run (default-cli) on project demo: Application finished with exit code: 1
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:215)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:156)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:148)
因为会报红如下所示信息,一直百度搜索如下关键字,大部分都是jdk配的不对,没解决问题
后来注意到第一行如下提示
Identify and stop the process that's listening on port 8080 or configure this application to listen on another port.
报的是端口错误,想着有可能是端口的原因,修改端口如下,编辑src/resources/application.properties文件
server.port=9099
在控制台执行如下命令,清理下缓存
./mvnw clean install
重启服务
./mvnw spring-boot:run -X
效果如下,可以正常访问了