Help Center/ CodeArts Build/ FAQs/ Maven Builds/ Why Is the New Package Still Built from the Old Code Even After the Code Has Been Updated?
Updated on 2024-10-10 GMT+08:00

Why Is the New Package Still Built from the Old Code Even After the Code Has Been Updated?

Symptoms

The local code is committed to a remote repository and the code in the remote repository has been updated. However, the code in the package generated after the build is decompressed and decompiled is still the old code.

Cause Analysis

Generally, this problem occurs because the user accidentally uploads the locally compiled file (in the target directory) to the remote repository and does not perform the clean operation before packaging.

Solution

  • Method 1: Delete the target directory of the remote repository.
  • Method 2: Add the clean parameter to the packaging command. For example, if the original packaging command is mvn package -Dmaven.test.skip=true -U -e -X -B, the following information is displayed after the clean parameter is added:
    mvn clean package -Dmaven.test.skip=true -U -e -X -B