代码之家  ›  专栏  ›  技术社区  ›  x80486

GitLab CI中的Maven项目生成不为后续生成使用缓存

  •  2
  • x80486  · 技术社区  · 6 年前

    tried 几乎所有组合/设置):

    image: openjdk:8u171-jdk-slim-stretch
    
    stages:
      - test
    
    variables:
      MAVEN_OPTS: "-Dmaven.repo.local=.m2/repository"
    
    cache:
      paths:
        - .m2/repository/
    
    before_script:
      - ./mvnw --version
    
    test:
      stage: test
      script:
        - ./mvnw verify
    

    我知道那些文物 d和不需要在使用此配置的成功生成之间一次又一次地下载,实际上,当触发生成时,我看到这些日志:

    section_start:1529253663:restore_cache
    Checking cache for default...
    Downloading cache.zip from http://runners-cache-4-internal.gitlab.com:444/runner/project/7034854/default
    Successfully extracted cache
    section_end:1529253664:restore_cache
    ...
    section_end:1529253698:build_script
    section_start:1529253698:after_script
    section_end:1529253699:after_script
    section_start:1529253699:archive_cache
    Creating cache default...
    .m2/repository/: found 1551 matching files
    target/: found 40 matching files
    Uploading cache.zip to http://runners-cache-4-internal.gitlab.com:444/runner/project/7034854/default
    Created cache
    section_end:1529253702:archive_cache
    section_start:1529253702:upload_artifacts
    section_end:1529253703:upload_artifacts
    Job succeeded
    

    …但我也看到每次从Maven Central下载每个工件/jar文件。

    有谁对GitLab CI很在行,能帮上忙吗?


    这是完整日志: https://gist.github.com/x80486/96e1e7274d179073d7deef26048a6d34 .

    1 回复  |  直到 6 年前
        1
  •  0
  •   secustor    6 年前

    image: maven:latest
    cache:
      key: "maven3"
    paths:
      - .m2/repository/