Using file artifacts

Instead of an archive task, we can also use a file as an artifact. Gradle tries to extract the extension and classifier properties from the filename. We can also configure these properties ourselves when we add the file as a publication artifact.

In the following example build file, we use the src/files/README and src/files/COPYRIGHT files as publication artifacts:

apply plugin: 'maven-publish'

publishing {
  publications {
    documentation(MavenPublication) {

      // Use file name as a publication artifact.
      artifact 'src/files/README'

      artifact('src/files/COPYRIGHT') {
        // Each file artifact must have a
        // unique classifier and extension.
        classifier = 'metaInformation'
      }

      // Alternative syntax is with
      // the Map notation:
      // artifact source: 'src/files/README'
      // artifact source: 'src/files/COPYRIGHT',
      //          extension: 'metaInformation'

    }
  }
}
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.119.103.96