【发布时间】:2016-07-09 17:15:33
【问题描述】:
我一直在尝试将我的 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>
任何想法为什么会发生这种情况? 提前致谢。
【问题讨论】:
-
它可能是您的 Maven 缓存中的一个损坏的 jar。尝试删除该缓存,或者至少删除其中的
org/springframework/boot部分,然后重新运行构建 -
@AndyWilkinson ... 删除了整个 .m2 文件夹,它工作正常,谢谢。
标签: spring maven spring-boot