Gradle build cache is not enabled for task

后端 未结 2 1922
萌比男神i
萌比男神i 2021-01-18 02:32

I have enabled gradle build cache for my project. But, we are using some non-built in tasks like npm-install from third party plugins. Gradle is not enabling cache for these

2条回答
  •  余生分开走
    2021-01-18 03:11

    A task needs to opt-in to being cacheable (see Cacheable tasks), since it doesn't make sense for every task to be cacheable.

    Opting in can happen by annotating the task with @CacheableTask or by using task.outputs.cacheIf { true }, so you could do that for the npm configure task.

    Note that cacheable tasks need to declare their inputs and outputs correctly. If they don't, then you may experience invalid build failures.

提交回复
热议问题