Remember an error caused by maven packaging

The day before the Qingming holiday on the 4th, when I was about to get off work, a colleague asked me to help me with a problem, thinking it was a very simple problem. Background description: Our development environment is based on the osgi framework. The business package is first packaged from the development environment through maven and then downloads the maven standard package. Description of the problem: The newly packaged package is uploaded to another environment, and a field is not initialized into the database. At first glance, I felt that some precautions were not configured, and then I looked at it, and it seemed that I had done it, but it was not initialized. Looking at the log, it was this field that was not initialized. Looking at the code of the development environment, there is no problem. Thinking that I can debug remotely, but the environment at hand does not have this version, it is also troublesome for git to cut branches. Then it started to go wrong.
 1. There is no problem with the code of the development environment. Check whether the configuration file of the field is there or not.
 2. Look at the package created by maven, in the configuration file, whether this field is present or not. Hey, what the hell is the modification time of the jar package on December 31, 2018, I asked him, why is this time wrong? He said that in order to verify something, the time needs to be changed. It seems that the problem lies here, because I have posted it several times. In theory, the modification time of this jar should be on the afternoon of April 4, but it has not been updated. I looked at the field configuration file in the jar package file. , and sure enough there is no such field. Then the problem is found.
 
 A few months ago, due to the optimization of release performance, it was found that when maven was packaged, it was time-consuming to clean. Considering the usual business scenarios, it was no problem if it was not cleaned, and then every time it was packaged, it would not be cleaned. When packaged, maven detects that the jar time is relatively new and will not go directly to the package. Then I deleted the target folder and republished it, but it still reported an error. This time, it was because the java code was wrong, and the packaging directly reported an error, which also verified my previous guess. When packaging, if the target jar The package time is very new, so there will be no package. Corrected the java syntax error, published it again, everything was ok, and the field was also updated.

To be honest, the maven package of the new environment will not be clean, but I delete the target by calling the command of the operating system to delete the folder. The speed is very fast, but there are still some problems with win servers. This needs to be optimized.

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325471752&siteId=291194637