Class GenerateArtifactMetadataTask

java.lang.Object
org.gradle.api.internal.AbstractTask
org.gradle.api.DefaultTask
com.konfigyr.gradle.GenerateArtifactMetadataTask
All Implemented Interfaces:
Comparable<org.gradle.api.Task>, org.gradle.api.internal.DynamicObjectAware, org.gradle.api.internal.TaskInternal, org.gradle.api.Named, org.gradle.api.plugins.ExtensionAware, org.gradle.api.Task, org.gradle.util.Configurable<org.gradle.api.Task>

@CacheableTask public abstract class GenerateArtifactMetadataTask extends org.gradle.api.DefaultTask
Task that scans this project's built JAR file archive for Spring Boot configuration metadata and, if found, writes it out as ArtifactMetadata describing this project's artifact.

This is the shared first step of both publishing scenarios: PublishArtifactMetadataTask publishes this metadata directly to the Artifactory, and CreateServiceReleaseTask includes it as one of the candidates for the service's own release, alongside every scanned dependency from ResolveServiceDependenciesTask. If this project's jar does not expose any Spring Boot configuration metadata, no output is written and both downstream tasks treat that artifact as absent.

Since:
1.1.0
  • Nested Class Summary

    Nested classes/interfaces inherited from interface org.gradle.api.Named

    org.gradle.api.Named.Namer
  • Field Summary

    Fields inherited from interface org.gradle.api.Task

    TASK_ACTION, TASK_CONSTRUCTOR_ARGS, TASK_DEPENDS_ON, TASK_DESCRIPTION, TASK_GROUP, TASK_NAME, TASK_OVERWRITE, TASK_TYPE
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    abstract org.gradle.api.file.RegularFileProperty
    The file this project's ArtifactMetadata is written to, if getProjectArchive() exposes Spring Boot configuration metadata.
    abstract org.gradle.api.file.RegularFileProperty
    This project's built jar, scanned for Spring Boot configuration metadata.
    abstract org.gradle.api.provider.Property<com.konfigyr.artifactory.Artifact>
    This project's Maven coordinates, used to build the ArtifactMetadata when this project's jar exposes Spring Boot configuration metadata.
    abstract org.gradle.api.file.ConfigurableFileCollection
    This project's own compile/runtime classpath, used purely to build a ClassLoader capable of resolving Java types referenced by this project's own Spring Boot configuration metadata (e.g.
    abstract org.gradle.api.provider.Property<ArtifactoryService>
    Returns the ArtifactoryService to use for constructing and writing the artifact metadata.

    Methods inherited from class org.gradle.api.DefaultTask

    compareTo, configure, dependsOn, doFirst, doFirst, doFirst, doLast, doLast, doLast, finalizedBy, getActions, getAnt, getDependsOn, getDescription, getDestroyables, getDidWork, getEnabled, getExtensions, getFinalizedBy, getGroup, getInputs, getLocalState, getLogger, getLogging, getMustRunAfter, getName, getOutputs, getPath, getProject, getShouldRunAfter, getState, getTaskDependencies, getTemporaryDir, getTimeout, hasProperty, mustRunAfter, onlyIf, onlyIf, onlyIf, property, setActions, setDependsOn, setDescription, setDidWork, setEnabled, setFinalizedBy, setGroup, setMustRunAfter, setOnlyIf, setOnlyIf, setOnlyIf, setProperty, setShouldRunAfter, shouldRunAfter, usesService

    Methods inherited from class org.gradle.api.internal.AbstractTask

    acceptServiceReferences, appendParallelSafeAction, doNotTrackState, doNotTrackStateIf, getAsDynamicObject, getIdentityPath, getImpliesSubProjects, getLifecycleDependencies, getOnlyIf, getReasonNotToTrackState, getReasonsNotToTrackState, getReasonTaskIsIncompatibleWithConfigurationCache, getRequiredServices, getServices, getSharedResources, getStandardOutputCapture, getTaskActions, getTaskIdentity, getTemporaryDirFactory, hasTaskActions, injectIntoNewInstance, isCompatibleWithConfigurationCache, isEnabled, isHasCustomActions, notCompatibleWithConfigurationCache, prependParallelSafeAction, restoreOnlyIf, restoreTaskActions, setImpliesSubProjects

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface org.gradle.api.Task

    doNotTrackState, notCompatibleWithConfigurationCache
  • Constructor Details

    • GenerateArtifactMetadataTask

      public GenerateArtifactMetadataTask()
  • Method Details

    • getService

      @Internal public abstract org.gradle.api.provider.Property<ArtifactoryService> getService()
      Returns the ArtifactoryService to use for constructing and writing the artifact metadata.
      Returns:
      the artifactory service to use, never null.
    • getProjectArchive

      @InputFile @PathSensitive(RELATIVE) public abstract org.gradle.api.file.RegularFileProperty getProjectArchive()
      This project's built jar, scanned for Spring Boot configuration metadata.
      Returns:
      this project's built jar, never null.
    • getRuntimeClasspath

      @InputFiles @CompileClasspath public abstract org.gradle.api.file.ConfigurableFileCollection getRuntimeClasspath()
      This project's own compile/runtime classpath, used purely to build a ClassLoader capable of resolving Java types referenced by this project's own Spring Boot configuration metadata (e.g. a property whose type is declared in one of this project's dependencies rather than in its own compiled classes). Never scanned for its own resource files — unlike getProjectArchive() — so @CompileClasspath normalization (ABI-only, ignores resources) is correct here, same as ArtifactMetadataTransform.getDependencies().
      Returns:
      this project's classpath, never null.
    • getProjectArtifact

      @Input @Optional public abstract org.gradle.api.provider.Property<com.konfigyr.artifactory.Artifact> getProjectArtifact()
      This project's Maven coordinates, used to build the ArtifactMetadata when this project's jar exposes Spring Boot configuration metadata. Absent if this project has no resolvable groupId/artifactId/version (e.g. a root project with no group/version of its own), in which case this task has nothing to generate regardless of what its jar contains.
      Returns:
      this project's artifact coordinates, never null.
    • getMetadata

      @OutputFile @Optional public abstract org.gradle.api.file.RegularFileProperty getMetadata()
      The file this project's ArtifactMetadata is written to, if getProjectArchive() exposes Spring Boot configuration metadata. Left unwritten otherwise.
      Returns:
      the metadata output file location, never null.