Why is uploadArchives not listed in the task list?

I thought uploadArchives is the task provided by the java plugin. In my build.gradle, I use the java plugin:

apply plugin: 'java' 

But if I call gradle tasks on the command line, I do not see the uploadArchives task.

Not even with gradle gradle tasks --all

The uploadArchives task is given in the documentation for the gradle java module plugin, see http://www.gradle.org/java_plugin (table 11).

I am using gradle version 1.0-milestone-6.

I can call gradle uploadArchives without errors, but no task specified.

+8
gradle
source share
2 answers

The uploadArchives task is usually added to your build script and obviously not by name. In the output of "gradle tasks" you should see this line:

 Pattern: upload <ConfigurationName>: Assembles and uploads the artifacts belonging to a configuration.

This means that for each configuration of your build file there is a corresponding uploadTask. The java plugin adds a configuration called archives to your build script. By adding the archives configuration to your script assembly explicitly using the java plugin, the uploadArchives task is also added implicitly.

There are scenarios where gradle cannot know which tasks should be implemented using the rule.

eg.

 tasks.addRule("Pattern: ping<ID>") { String taskName -> if (taskName.startsWith("ping")) { task(taskName) << { println "Pinging: " + (taskName - 'ping') } } } 

It is not possible to determine which ping tasks should be displayed, since they simply materialize when launched from the command line via 'gradle pingServer1 pingServer2 pingServer3'

Regards, Renee

+9
source share

The uploadArchives task is part of the maven-plugin. You must add:

 apply plugin: 'maven' 
+1
source share

All Articles