一、打包方式的不同致使jar包运行性能及docker部署的效率问题
1.1方式一
<build><plugins><plugin><groupId>org.apache.maven.plugins</groupId><artifactId>maven-compiler-plugin</artifactId><configuration><source>${java.version}</source><target>${java.version}</target><encoding>UTF-8</encoding></configuration></plugin></plugins></build>
打包后
反解析包结构
tar -xf test-0.0.1-SNAPSHOT.jar
此种方式可以看到反解析后,文件比较散乱
1.2方式二
<build><plugins><plugin><groupId>org.springframework.boot</groupId><artifactId>spring-boot-maven-plugin</artifactId></plugin></plugins></build>
打包后
反解析包
此种方式可以看到反解析后,文件都在BOOT-INF
1.3总结
如果不考虑运行方式,两种都可以java -jar
如果需要容器化 docker 则通常使用第二种