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

plugins

(Rafael Cavazin) #1

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 ?

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

I was doing something like:

target.tasks.findByName(‘test’).configure({
include '/Test.'
exclude '
/IntegrationTest.'
testLogging {
showStandardStreams = true
exceptionFormat “full”
}
});

But didn´t work with UploadTask


(Stefan Oehme) #2

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?