简体   繁体   English

可以从 eclipse 但不能从终端运行 spring 引导应用程序

[英]Can run spring boot application from eclipse but not from terminal

I have a problem with a Spring boot project, it has another spring boot project as a dependency in its pom.xml.我对 Spring 引导项目有疑问,它在其 pom.xml 中有另一个 spring 引导项目作为依赖项。 I can run it properly using eclipse, but an error shows up when I try to run it with terminal using the command mvn spring-boot:run .我可以使用 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

This is how I added the dependency in pom.xml:这就是我在 pom.xml 中添加依赖项的方式:

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

I have tried different solutions like mvn package spring-boot:repackage but it didn't work.我尝试了不同的解决方案,例如mvn package spring-boot:repackage但它没有用。

Thank you so much.太感谢了。

Add this plugin after dependencies in pom.xmlpom.xml中的依赖项之后添加此插件

<build>
    <plugins>
        <plugin>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-maven-plugin</artifactId>
        </plugin>
    </plugins>
</build>

Save this and run again.保存并再次运行。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM