构建Spring Boot应用程序 - Maven错误

时间:2016-07-09 17:15:34

标签: spring maven spring-boot

我一直试图将我的spring-boot应用程序打包成一个war文件,但错误不断出现,到目前为止我已经解决了3但我仍然坚持这个。

错误

Failed to execute goal org.springframework.boot:spring-boot-maven-plugin:1.3.5.RELEASE:repackage
 (default) on project pns: Execution default of goal org.springframework.boot:spring-boot-maven-plugin:1.3.5.RELEASE:repackage failed: 
A required class was missing while executing org.springframework.boot:spring-boot-maven-plugin:1.3.5.RELEASE:repackage: 
org/springframework/boot/loader/tools/LaunchScript

应用程序属性

<properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <java.version>1.8</java.version>
        <start-class>iq.pns.PushNotificationServerApplication</start-class>
</properties>

构建配置

<build>
    <plugins>
        <plugin>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-maven-plugin</artifactId>
            <configuration>
                <mainClass>${start-class}</mainClass>
                <layout>WAR</layout>
            </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.17</version>
        </plugin>
    </plugins>
</build>

为什么会发生这种情况? 提前谢谢。

1 个答案:

答案 0 :(得分:1)

原来是Maven缓存中的一个损坏的jar,就像@AndyWilkinson建议的那样。

通过删除~/.m2/repository folderand让Maven重新下载所有内容来解决。