Interface MojoMetadataProvider.Context.Outputs

  • Enclosing interface:
    MojoMetadataProvider.Context

    public static interface MojoMetadataProvider.Context.Outputs
    The outputs of a goal are packed into the cache entry and restored when they are loaded from the build cache. Every goal execution starts out as "not supported". It has to be explicitly marked as cacheable in order to benefit from build caching. If any reason for being non-cacheable is given (e.g. via notCacheableBecause(String)), the goal execution's outputs will not be cached, even if it was marked as cacheable.
    Since:
    1.15
    • Method Detail

      • file

        MojoMetadataProvider.Context.Outputs file​(java.lang.String propertyName,
                                                  java.lang.Object file)
        Registers the given file as an output property.
        Parameters:
        propertyName - the name of the property to be registered as an output file
        file - can be a String, Path, URI or File represented through an absolute or a relative path to a file. If it is a relative path, it will be resolved using the current project's base directory.
        Since:
        1.15
      • directory

        MojoMetadataProvider.Context.Outputs directory​(java.lang.String propertyName,
                                                       java.lang.Object directory)
        Registers the given file as an output property.
        Parameters:
        propertyName - the name of the property to be registered as an output directory
        directory - can be a String, Path, URI or File represented through an absolute or a relative path to a directory. If it is a relative path, it will be resolved using the current project's base directory.
        Since:
        1.15
      • cacheable

        MojoMetadataProvider.Context.Outputs cacheable​(java.lang.String reason)
        Marks the outputs of this goal execution as cacheable. The supplied reason should fit well in the following sentence: "Build caching was enabled for this goal execution because ...".
        Parameters:
        reason - the reason why the goal execution's outputs are cacheable
        Since:
        1.15
      • notCacheableBecause

        MojoMetadataProvider.Context.Outputs notCacheableBecause​(java.lang.String reason)
        Disables caching of the outputs of this goal execution. The supplied reason should fit well in the following sentence: "Build caching was not enabled for this goal execution because ...".
        Parameters:
        reason - the reason why the goal execution's outputs are not cacheable
        Since:
        1.15
      • storeEnabled

        MojoMetadataProvider.Context.Outputs storeEnabled​(boolean enabled)
        Configures whether results for this goal should be stored in the build cache or only read from it. This can be useful when the outputs of this goal are only safe to be stored under certain circumstances, e.g. only on clean builds or only on CI builds.
        Parameters:
        enabled - whether results for this goal should be stored in the build cache
        Since:
        1.15