How to programatically add a 'uploadArchives' task on a Plugin<Project>?

I have a “class GradleCommonsPlugin implements Plugin”

and I would like to add a configuration similar to this one below, so all the projects that apply this plugin will get this task already configured.

  1. Does this makes any sense ? is there a proper place to put such things ? (I have like 100 java modules)

  2. Can this be done programatically ? How ?

uploadArchives {
repositories {
mavenDeployer {
repository(url: ‘myURL’){
authentication(userName: mavenUser, password: mavenPassword)
pom.version = project.version
pom.artifactId =
pom.groupId =

I was doing something like:

include '/Test.'
exclude '
testLogging {
showStandardStreams = true
exceptionFormat “full”

But didn´t work with UploadTask

What didn’t work? Can you show us what you tried doing (a simplified version of your plugin maybe?). Also, what error did you get?