Gradle Publish Task & Proguard

20 Views Asked by At

I would like to publish an obfuscated artifact on Github Sonatype. I don't know how to specify the publish task to use the obfuscated artifact. The Proguard task creates a separate jar, in outjar, and this should be published. Is there any way to specify the jar to be used?

Can you please help me?


task proguard(type:proguard.gradle.ProGuardTask, dependsOn:['clean','jar']) {
    configuration 'resources/install/proguard.txt'
    libraryjars files(configurations.runtimeClasspath.collect())
    // CHECK IN gradle.properties org.gradle.java.home.
    libraryjars "${System.env.JAVA_HOME}/jmods/"

    injars "$buildDir/libs/dbs.jar"
    outjars "$buildDir/app-libs/dbschema.jar"
}

publishing {
    publications {
        mavenJava(MavenPublication) {
            artifactId = 'dbschema'
            from components.java
            versionMapping {
                usage('java-api') {
                    fromResolutionOf('runtimeClasspath')
                }
                usage('java-runtime') {
                    fromResolutionResult()
                }
            }
            pom {
                name = 'DbSchema'
                description = 'DbSchema Database Management GUI'
                url = 'https://dbschema.com'
                licenses {
                    license {
                        name = 'Perpetual Fallback License'
                        url = 'https://dbschema.com'
                    }
                }
                developers {
                    developer {
                        id = 'wisecoders'
                        name = 'Wise Coders GmbH'
                        email = '[email protected]'
                    }
                }
                scm {
                    connection = 'scm:git:git://github.com/wise-coders/dbschema'
                    developerConnection = 'scm:git:ssh://github.com/wise-coders/dbschema'
                    url = 'https://github.com/wise-coders/dbschema'
                }
            }
        }
    }
    repositories {
        maven {
            name = "OSSRH"
            url = "https://s01.oss.sonatype.org/content/repositories/releases/"
            credentials {
                username = project.properties["sonatypeUsername"]
                password = project.properties["sonatypePassword"]
            }
        }
    }
}
signing {
    sign publishing.publications.mavenJava
}


0

There are 0 best solutions below