【问题标题】:Can run spring boot application from eclipse but not from terminal可以从 Eclipse 运行 Spring Boot 应用程序,但不能从终端运行
【发布时间】:2020-05-12 10:01:57
【问题描述】:

我的 Spring Boot 项目有问题,它在 pom.xml 中有另一个 Spring Boot 项目作为依赖项。 我可以使用 eclipse 正确运行它,但是当我尝试使用命令mvn spring-boot:run 使用终端运行它时会出现错误。

[ERROR] Failed to execute goal on project platform-service: Could not resolve dependencies for project com.test.platform:platform-service:jar:0.0.1-SNAPSHOT: Could not find artifact com.test:student-service:jar:exec:0.0.1-SNAPSHOT

这就是我在 pom.xml 中添加依赖项的方式:

<dependency>
            <groupId>com.test</groupId>
            <artifactId>student-service</artifactId>
            <version>0.0.1-SNAPSHOT</version>
</dependency>

我尝试了不同的解决方案,例如 mvn package spring-boot:repackage,但没有奏效。

非常感谢。

【问题讨论】:

  • 您添加了 com. talan :student-service 但应用程序抱怨 com. test :学生服务缺失。错字?
  • @Benoit 我修好了,但还是不行
  • 您可以发布您尝试在 Eclipse 中运行的项目的 pom.xml 吗?

标签: java eclipse spring-boot maven


【解决方案1】:

pom.xml

的依赖后添加这个插件
<build>
    <plugins>
        <plugin>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-maven-plugin</artifactId>
        </plugin>
    </plugins>
</build>

保存并再次运行。

【讨论】:

    猜你喜欢
    • 2014-08-03
    • 2021-03-11
    • 2021-09-12
    • 1970-01-01
    • 1970-01-01
    • 2016-10-17
    • 1970-01-01
    • 1970-01-01
    • 2017-11-08
    相关资源
    最近更新 更多