GradleUp/shadow

two jar files in maven repo

onixred opened this issue · 2 comments

I want to publish a jar without dependencies to the repositories. But as a result of publishing I have two jar files. like a disaster, fat jar. help me.

Shadow Version

'8.1.1'

Gradle Version

'8.5'

Gradle Build Script(s)

plugins {
    id 'application'
    id 'com.github.johnrengelman.shadow' version '8.1.1'
    id 'java-library'
    id 'maven-publish'
}
...

repositories {
    mavenCentral()
}

configurations {
    developmentOnly
}


dependencies {
    compileOnly 'com.github.spotbugs:spotbugs-annotations:4.8.2'
    implementation 'org.jetbrains:annotations:24.1.0'
    implementation 'org.bytedeco:javacv:1.5.9'
}


shadowJar {
    mergeServiceFiles()
}


publishing {
    publications {
        Library(MavenPublication) {
            from components.java
        }
    }
}

same issue my subproject ingestion is generating:

ingestion.jar
ingestion-all.jar

Despite I also have
mergeServiceFiles()
in my config

the -all file is much larger than the non -all.I Have a project on 7.1.2 and another on 8.1.1 and both are doing that. In the past I used an older version that it would only generate 1 jar

I remove from components.java and use customized artifacts to solve this issue

publishing {
    publications {
        maven(MavenPublication) {
            artifactId = 'xxx'
            version = version
            artifacts = [jar, javadocJar, sourceJar]                     
       }
    }
}