twwwt
twwwt

Reputation: 502

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 (i.e., 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.

Upvotes: 0

Views: 545

Answers (2)

twwwt
twwwt

Reputation: 502

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

Upvotes: 0

J Fabian Meier
J Fabian Meier

Reputation: 35863

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.

Upvotes: 1

Related Questions