我无法使 gradle 增量功能在具有多个步骤的 bitbucket 管道上工作。 我喜欢拥有的是:
阅读文档,我添加了构建文件夹,甚至 .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.
这似乎是一个微不足道的设置,我做错了什么吗?
我也遇到了同样的问题。
该问题似乎是由于将文件上传到工件时排除空目录引起的。
在执行
mkdir -p build/generated/sources/{annotationProcessor,headers}/java/main
之前尝试运行 ./gradlew core:test
。