SpringBoot聚合项目打包
1.打包遇到的问题:
子模块打包时,每次打包出来的jar都只有3k左右,没办法运行,目测应该是依赖的jar没有打包进来!
2.解决办法:
2.1.主项目的pom.xml里面不需要打包配置
2.2.在需要打包的项目pom.xml文件里做如下打包配置
<build> <finalName>microservice-eureka-7001</finalName> <resources> <resource> <directory>src/main/java</directory> <filtering>true</filtering> <includes> <include>**/*.xml</include> </includes> </resource> <resource> <directory>src/main/resources</directory> <includes> <include>**.*</include> <include>**/*.*</include><!-- i18n能读取到 --> <include>**/*/*.*</include> </includes> </resource> </resources> <plugins> <plugin> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-maven-plugin</artifactId> <configuration> <fork>true</fork> <!-- 如果没有该配置,devtools不会生效 --> <!-- 指定该Main Class为全局的唯一入口 --> <mainClass>com.fdzang.microservice.eureka.EurekaServer7001_App</mainClass> <layout>ZIP</layout> </configuration> <executions> <execution> <goals> <goal>repackage</goal><!--可以把依赖的包都打包到生成的Jar包中--> </goals> </execution> </executions> </plugin> </plugins> </build>
2.3.重点:
<executions>
<execution>
<goals>
<goal>repackage</goal><!--可以把依赖的包都打包到生成的Jar包中-->
</goals>
</execution>
</executions>