Caused by: java.lang.ClassNotFoundException: org.springframework.boot.SpringApplication
spring-boot-maven-plugin 配置如下:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
<packaging>jar</packaging> <build> <plugins> <plugin> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-maven-plugin</artifactId> <version>2.6.2</version> <configuration> <layers> <enabled>false</enabled> </layers> <fork>true</fork> <mainClass>cn.javacoder.stockanalyze.StockAnalyzerApplication</mainClass> <layout>WAR</layout> <finalName>stock-web</finalName> </configuration> </plugin> </plugins> </build> |
将jar工程按war结构repackage,但是spring-boot-maven-plugin打包的结果不符合war包规范
classes没有放在WEB-INF下
添加web.xml 且<packaging>war</packaging>
让工程按war编译,然后使用spring-boot-maven-plugin重新打包成胖war包
Posted in: spring practise
Comments are closed.