Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

two jar files in maven repo #898

Open
onixred opened this issue Dec 16, 2023 · 2 comments
Open

two jar files in maven repo #898

onixred opened this issue Dec 16, 2023 · 2 comments

Comments

@onixred
Copy link

onixred commented Dec 16, 2023

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
        }
    }
}

@sharmando
Copy link

sharmando commented Mar 25, 2024

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

@puritys
Copy link

puritys commented May 28, 2024

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]                     
       }
    }
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants