With Gralde 6.6 it is suggested to use the predefined function when publish a jar:
java { withJavadocJar() withSourcesJar() }
I am using