简体   繁体   中英

Deploy artifact to Maven repository that has no file extension

I want to deploy binary artifacts (Linux and Mac OS X executables) to a Maven repository using Gradle's MavenPublication such that they are stored in the repository without a file extension (as is the case by default for binaries/executables on Linux and Mac).

Say I have a binary foo in version 1.0.0 ; in Maven terminology these would be the artifactId and version , respectively. The closest I can get is to deploy it under the name foo-1.0.0. - note the trailing dot ( . ). I would rather want it to be stored under the name foo-1.0.0 (ie, without the dot). I tried not specifying the extension property, and I also tried specifying an empty extension='' .

publishing {
  publications {
    maven(MavenPublication) {
      artifact("some/parent/dir/foo") {
        extension ''
      }
    }
  }
}

Is it possible to achieve this? As a related question, what packaging should be specified in the POM for such binaries. I've checked Maven's list of artifact handler types but this list does not mention a packaging for binaries, nor those without an extension. I thought about setting it to binary , but I'm not sure about consequences this might have.

A Maven repository is the wrong place for this.

Maven repositories work by Maven coordinates ( groupId , artifactId , version ), not by file names. The file name is just an internal representation of an artifact with a given set of coordinates.

Answering the question myself, as far as I have found out, this is currently not possible with Gradle's MavenPublication .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM