Bitbucket 多步骤管道上的 Gradle 增量构建

问题描述 投票:0回答:1

我无法使 gradle 增量功能在具有多个步骤的 bitbucket 管道上工作。 我喜欢拥有的是:

  1. 编译代码的步骤
  2. 测试正在编译的代码的步骤(无需重新编译)

阅读文档,我添加了构建文件夹,甚至 .gradle 文件夹作为编译步骤的工件:

default:
    - step:
        name: Compile the application
        caches:
          - gradlew
        script:
          - ./gradlew core:compileJava
        artifacts:
          - .gradle/**
          - build/**
    - step:
        name: Run the unit tests
        caches:
          - gradlew
        script:
          - ./gradlew core:test

使用

find
命令我可以看到编译的类和 .gradle 文件 进入
unit test
步骤。

但是

unit test
步骤始终重新运行编译过程并使用它输出的
-i
选项:

Task ':core:compileJava' is not up-to-date because:
  Output property 'options.generatedSourceOutputDirectory' file /opt/atlassian/pipelines/agent/build/core/build/generated/sources/annotationProcessor/java/main has been removed.
  Output property 'options.headerOutputDirectory' file /opt/atlassian/pipelines/agent/build/core/build/generated/sources/headers/java/main has been removed.

这似乎是一个微不足道的设置,我做错了什么吗?

gradle bitbucket bitbucket-pipelines
1个回答
0
投票

我也遇到了同样的问题。
该问题似乎是由于将文件上传到工件时排除空目录引起的。

在执行

mkdir -p build/generated/sources/{annotationProcessor,headers}/java/main
之前尝试运行
./gradlew core:test

© www.soinside.com 2019 - 2024. All rights reserved.