首页 > 解决方案 > SpringBoot重新打包失败如何解决?

问题描述

我目前正在学习使用多模块的 SpringBoot 教程。但是,当我尝试打包时,这会返回错误:

[ERROR] Failed to execute goal org.springframework.boot:spring-boot-maven-plugin:2.1.5.RELEASE:repackage (repackage) on project pet-clinic-data: Execution repackage of goal org.springframework.boot:spring-boot-maven-plugin:2.1.5.RELEASE:repackage failed: Unable to find main class -> [Help 1]

我试图在我的父 pom 文件中添加这样的内容:

<properties>
    <java.version>1.8</java.version>
    <start-class>guru.springframework.sfgpetclinic.SfgPetClinicApplication</start-class>
</properties>

但这会引发另一个错误:

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.22.2:test (default-test) on project pet-clinic-web: There are test failures.

这是基于模块pet-clinic-data之一:

<build>
    <plugins>
       <plugin>
           <groupId>org.springframework.boot</groupId>
           <artifactId>spring-boot-maven-plugin</artifactId>
           <executions>
                <execution>
                    <goals>
                        <goal>repackage</goal>
                    </goals>
                    <configuration>
                        <skip>true</skip>
                    </configuration>
                </execution>
            </executions>
        </plugin>
    </plugins>
</build>

编辑!

@RunWith(SpringRunner.class)
@SpringBootTest
public class SfgPetClinicApplicationTests {

    @Test
    public void contextLoads() {
    }

}

标签: javamavenspring-bootmulti-moduleparent-pom

解决方案


推荐阅读