我要评分
获取效率
正确性
完整性
易理解

spring-cloud-contract Error Reported in the GitStubDownloaderTest Case

Symptom

During compilation and installation, the message "Caused by: java.nio.file.NoSuchFileException: /tmp/git-contracts-1590371014299-0/.git/gc.log.lock" is reported in the GitStubDownloaderTest case.

Key Process and Cause Analysis

This problem is caused by running exception of garbage collection (GC). Disable GC to solve this problem.

Conclusion and Solution

  1. Open the GitStubDownloaderTests.java file.
    vim spring-cloud-contract-stub-runner/src/test/java/org/springframework/cloud/contract/stubrunner/GitStubDownloaderTests.java
  2. Search map for props(), and add the following content:
                    map.put("gc.auto", "0");
                    map.put("gc.autoPackLimit", "0");
                    map.put("receive.autogc", "false");

  3. Press Esc, type :wq!, and press Enter to save the file and exit.
  4. Run the compile command again.
    ./mvnw clean install -Dgpg.skip=true