【问题标题】:Failed to execute goal org.springframework.boot:spring-boot-maven-plugin:2.5.5:run (default-cli)未能执行目标 org.springframework.boot:spring-boot-maven-plugin:2.5.5:run (default-cli)
【发布时间】:2021-11-23 12:03:14
【问题描述】:

我是 Spring 新手,我试图按照其官方网站上给出的教程进行操作,但弹出此错误。

Failed to execute goal org.springframework.boot:spring-boot-maven-plugin:2.5.5:run (default-cli) on project backend: Application finished with exit code: 1 -> [Help 1]

以下是我的 pom.xml

4.0.0 org.springframework.boot spring-boot-starter-parent 2.5.5 com.example 后端 0.0.1-快照 后端 Spring Boot 的演示项目 11

    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter</artifactId>
    </dependency>

    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-test</artifactId>
        <scope>test</scope>
    </dependency>

    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-beans</artifactId>
        <version>4.3.7.RELEASE</version>
    </dependency>
    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-context</artifactId>
        <version>4.3.7.RELEASE</version>
    </dependency>

    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-web</artifactId>
    </dependency>
</dependencies>

<build>
    <plugins>
        <plugin>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-maven-plugin</artifactId>
            <configuration>
                <mainClass>BackendApplication</mainClass>
            </configuration>
            <executions>
                <execution>
                    <goals>
                        <goal>repackage</goal>
                    </goals>
                </execution>
            </executions>
        </plugin>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-surefire-plugin</artifactId>
            <version>2.5.5</version>
            <configuration>
                <skipTests>false</skipTests>
                <testFailureIgnore>true</testFailureIgnore>
                <forkMode>once</forkMode>
            </configuration>
        </plugin>           
    </plugins>
    
</build>

知道为什么不工作吗?我根据其他人的错误尝试了许多方法,但都没有奏效。现在有点沮丧。任何帮助将不胜感激

【问题讨论】:

  • 使用-X 参数运行您的maven 以获取日志中的原因,如果仍然没有帮助,请在此处发布应用程序的堆栈跟踪

标签: java spring spring-boot maven


【解决方案1】:

这个错误基本上是由于插件问题。

通过运行这些命令为项目创建一个 jar

mvn clean install 然后java -jar jar-localtion.jar

【讨论】:

    猜你喜欢
    • 2020-06-27
    • 1970-01-01
    • 1970-01-01
    • 2023-03-17
    • 2020-04-20
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-07-08
    相关资源
    最近更新 更多