[Pit] executable configuration of spring-boot-maven-plugin

[Pit] executable configuration of spring-boot-maven-plugin

Problem Description

Recently, after deploying the project built by Spring Boot to the production environment through the company's unified deployment platform, there was a problem that the project startup log did not exist during deployment. Result : The project failed to start.


Self-examination process

  1. Download the compiled pre-release package to the local, and the content is as shown in the figure below. After inspection, the content of the package is completely correct.

  2. Next, apply for the bastion machine login permission, log in to the container, and the content is as follows:

Result : It is found that the contents of the decompressed WAR package in the container are basically gone, only the configuration file covered by the configuration on the deployment platform is left. There may be a problem when unzipping the WAR package .


Help process

1. After asking for help from colleagues in the deployment platform department, the reply is as follows:

  1. After reading the project pom.xml, the content is as follows:

really! spring-boot-maven-pluginPlug-in excutableconfiguration does not set false! ! !

Result : After modifying it to false, recompile, build the image, deploy, and the project starts successfully. The problem is solved successfully!


In-depth analysis of the problem

  1. What does the excutable configuration of the spring-boot-maven-plugin plug-in do?

That is, if this configuration is set true, packed out of jar/war is executable in, and can be performed in the following manner:

  1. Why does it fail when I decompress the WAR package after setting it to false? The Spring Boot official website document says:

Fully executable of jar/war in front of a file embedded additional scripts , which makes some command fails, for example, jar -xfand so on. Check the log of the unified deployment platform when building the image, as shown in the figure below, and found that this command was used, so the WAR package will fail to decompress! ! !


summary

We will deploy Spring Boot project package, if you use jar -xfsuch as decompression command, must pay attention to springboot the maven plug- spring-boot-maven-pluginin executableconfiguration must be set false! ! ! Otherwise it will fail to decompress!


Share my short book HelloLittleRain (link poke me)