bertramdev / asset-pipeline

The core implementation of the asset pipeline for the jvm
194 stars 92 forks source link

Gradle 7 compatibility #278

Closed yevhensayenko closed 3 years ago

yevhensayenko commented 3 years ago

Asset pipeline Gradle plugin seems to be not working when using Gradle 7.x.x. Works only with Gradle 6.9 and below.

When running assetCompile task on Spring Boot project with Gradle 7.1.1 I get the following validation messages:

FAILURE: Build failed with an exception.

* What went wrong:
Some problems were found with the configuration of task ':assetCompile' (type 'AssetCompile').
  - In plugin 'com.bertramlabs.asset-pipeline' type 'asset.pipeline.gradle.AssetCompile' property 'assetsDir' has @Input annotation used on property of type 'File'.

    Reason: A property of type 'File' annotated with @Input cannot determine how to interpret the file.

    Possible solutions:
      1. Annotate with @InputFile for regular files.
      2. Annotate with @InputDirectory for directories.
      3. If you want to track the path, return File.absolutePath as a String and keep @Input.

    Please refer to https://docs.gradle.org/7.1.1/userguide/validation_problems.html#incorrect_use_of_input_annotation for more details about this problem.
  - In plugin 'com.bertramlabs.asset-pipeline' type 'asset.pipeline.gradle.AssetCompile' property 'assetsPath' is missing an input or output annotation.

    Reason: A property without annotation isn't considered during up-to-date checking.

    Possible solutions:
      1. Add an input or output annotation.
      2. Mark it as @Internal.

    Please refer to https://docs.gradle.org/7.1.1/userguide/validation_problems.html#missing_annotation for more details about this problem.
  - In plugin 'com.bertramlabs.asset-pipeline' type 'asset.pipeline.gradle.AssetCompile' property 'classpath' is annotated with @InputFiles but missing a normalization strategy.

    Reason: If you don't declare the normalization, outputs can't be re-used between machines or locations on the same machine, therefore caching efficiency drops significantly.

    Possible solution: Declare the normalization strategy by annotating the property with either @PathSensitive, @Classpath or @CompileClasspath.

    Please refer to https://docs.gradle.org/7.1.1/userguide/validation_problems.html#missing_normalization_annotation for more details about this problem.
  - In plugin 'com.bertramlabs.asset-pipeline' type 'asset.pipeline.gradle.AssetCompile' property 'compileDir' is missing an input or output annotation.

    Reason: A property without annotation isn't considered during up-to-date checking.

    Possible solutions:
      1. Add an input or output annotation.
      2. Mark it as @Internal.

    Please refer to https://docs.gradle.org/7.1.1/userguide/validation_problems.html#missing_annotation for more details about this problem.
  - In plugin 'com.bertramlabs.asset-pipeline' type 'asset.pipeline.gradle.AssetCompile' property 'developmentRuntime' is missing an input or output annotation.

    Reason: A property without annotation isn't considered during up-to-date checking.

    Possible solutions:
      1. Add an input or output annotation.
      2. Mark it as @Internal.

    Please refer to https://docs.gradle.org/7.1.1/userguide/validation_problems.html#missing_annotation for more details about this problem.
bruno-lopes commented 2 years ago

I had the same problem. After updating the plugin to version 3.3.6, now I get the following:

FAILURE: Build completed with 2 failures.

1: Task failed with an exception.
-----------
* What went wrong:
A problem was found with the configuration of task ':my-plugin:assetPluginPackage' (type 'AssetPluginPackage').
  - In plugin 'com.bertramlabs.asset-pipeline' type 'asset.pipeline.gradle.AssetPluginPackage' property 'assetsDir' specifies directory '/home/bruno/git/my-app/my-plugin/grails-app/assets' which doesn't exist.

    Reason: An input file was expected to be present but it doesn't exist.

    Possible solutions:
      1. Make sure the directory exists before the task is called.
      2. Make sure that the task which produces the directory is declared as an input.

    Please refer to https://docs.gradle.org/7.3.3/userguide/validation_problems.html#input_file_does_not_exist for more details about this problem.

* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.

How could I configure the plugin to ignore this kind of error?

mrankin32 commented 2 years ago

You're going to love this solution. I had to add a empty assets directory to make the aforementioned error go away.

davydotcom commented 2 years ago

Yep annoyingly it's a gradle bug. looking into it