How to sign a jar with Jarsigner in the task jar?

i want to sign the jars with Jarsigner,what can i do?

task androidReleaseJar(type: Jar, dependsOn: assembleRelease) {
        from "$buildDir/intermediates/classes/release/"
        exclude '**/BuildConfig.class'
        exclude '**/R.class'
        exclude '**/R$*.class'
    }
      task androidJavadocsJar(type: Jar) {
        classifier = 'javadoc'
        from "generateReleaseJavadoc.destinationDir"
    }
      task androidSourcesJar(type: Jar) {
        classifier = 'sources'
        from android.sourceSets.main.java.srcDirs
    }