Skip to content

"-all" classifier dropped from published jar #860

@HexagonSun

Description

@HexagonSun

When publishing a Maven artifact using Shadow 8.1.1, the "-all" classifier is dropped from the jar file.

This happens for both local publishing and to remote repositories, too.

Shadow Version

8.1.1

Gradle Version

8.1

Expected Behavior

Building using Shadow 8.1.0

  rm -rf build && rm -rf ${local-maven-repo} && gw publishToMavenLocal

produces the following artifacts:

  /Users/hexagonsun/.m2/repository/net/hexagon/sun/foo$find .
  .
  ./dev-local
  ./dev-local/foo-dev-local.pom
  ./dev-local/foo-dev-local-all.jar
  ./maven-metadata-local.xml

Actual Behavior

Building with Shadow 8.1.1

  rm -rf build && rm -rf ${local-maven-repo} && gw publishToMavenLocal

produces the following artifacts:

  /Users/hexagonsun/.m2/repository/net/hexagon/sun/foo$find .
  .
  ./dev-local
  ./dev-local/foo-dev-local.pom
  ./dev-local/foo-dev-local.jar
  ./maven-metadata-local.xml

Note that the jar is lacking the -all qualifier.

In both cases, i.e. with Shadow 8.1.0 as well as the new 8.1.1, the shadow-jar of the application's build directory correctly contains the -all classifier:

  /Users/hexagonsun/dev/foo/build$find . -iname "*.jar"
  ./libs/foo-dev-local-all.jar

Gradle Build Script(s)

import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar

plugins {
    val kotlinVersion = "1.8.20"

    application
    `maven-publish`
    kotlin("jvm") version kotlinVersion
    id("com.github.johnrengelman.shadow") version "8.1.1"
}

group = "net.hexagon.sun.foo"
version = "dev-local"

repositories {
    val mavenCentralProxyUrl: String by properties
    maven { url = uri(mavenCentralProxyUrl) }
}

dependencies {
    implementation(kotlin("stdlib"))
}

application {
    mainClass.set("net.hexagon.sun.foo.ApplicationKt")
}

tasks {
    withType<ShadowJar> {
        archiveClassifier.set("all")
    }
}

publishing {
    publications {
        create<MavenPublication>("shadow") {
            project.shadow.component(this)
        }
    }
}

Note that the line archiveClassifier.set("all") is not relevant: the same problem occurs when it is missing.

Content of Shadow JAR (jar tf <jar file> - post link to GIST if too long)

I don't think this is relevant, since the content is fine. Let me know if I should supply it.
The behavior can be reproduced using a default Application.kt file.

package net.hexagon.sun.foo

fun main() {
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions