0

I have created a gradle plugin project using java language and looking to publish the generated jar after obfuscating but not able to get related document in gradle help page.

I have googled but getting android related configuration setup, is there any inbuilt functionality available to obfuscate in gradle during compile and jar creation? can anyone help?

This is my plugin project build.gradle

plugins {
    id 'java-gradle-plugin'
    id 'maven-publish'
}
repositories {
    mavenCentral()
}
dependencies {
    testImplementation 'org.junit.jupiter:junit-jupiter:5.7.1'
}
gradlePlugin {
    plugins {
        greeting {
            id = 'com.zo.sign'
            implementationClass = 'signpackage.SignPackagePlugin'
        }
    }
}

publishing {
    publications {
        maven(MavenPublication) {
            groupId = 'com.zo.sign'
            artifactId = 'signpkg'
            version = '1.0'
            from components.java
        }
    }
    repositories {
        maven {
            // change URLs to point to your repos, e.g. http://my.org/repo
            def releasesRepoUrl = layout.buildDirectory.dir('repos/releases')
            def snapshotsRepoUrl = layout.buildDirectory.dir('repos/snapshots')
            url = version.endsWith('SNAPSHOT') ? snapshotsRepoUrl : releasesRepoUrl
        }
    }
}
arunkumar A
  • 53
  • 1
  • 7
  • 1
    Please share your buildscript that include the relevant parts. I can say that there is no built-in obfuscation functionality, but it can be achieved using plugins. However, stackoverflow is not a search engine, we can help if you have problems with your buildscript, but usually nobody will write a complete example build script just for you. – Leonard Brünings Mar 24 '23 at 14:07
  • 1
    Maybe this helps https://stackoverflow.com/questions/64355998/proguard-example-for-gradle-java-application – Leonard Brünings Mar 24 '23 at 14:07
  • @LeonardBrünings Thank you for the reply, I have edited my post by adding build.grade. – arunkumar A Mar 28 '23 at 15:27

0 Answers0