I have a project which generates a tar file and then uploads the tar file to
a repository. Since there is no javac/jar step involved, I do not "apply
plugin: 'java'" and there is no uploadArchives task (if I understand
correctly how that task is created).

I've added my own configuration and artifacts but the upload task for my
configuration doesn't seem to exist from the rootProject's scope.

Relevant portions of build.gradle:


version = "1-SNAPSHOT"

configurations {
  biit
}

distArtifact = file('build/libs/biit-${version}.tar')
artifacts {
  biit distArtifact
}

uploadBiit {
  repositories {
    // defined in built-tools.gradle
    add project.repositories.releases
  }
}



The code above will cause the following error when invoking any gradle
target:


FAILURE: Build failed with an exception.

* Where:
Build file '/home/ggavares/workspace2/trunk/build.gradle' line: 71

* What went wrong:
A problem occurred evaluating root project 'biit'.
Cause: Could not find method uploadBiit() for arguments
[build_27pv5sk08oavi25lidktdpnaqi$_run_closure9@61891732] on root project
'biit'.




I've added an info task to do some inspection:


task info(){                                                                    
                                                                                
                                                                               
  println "Tasks: " + rootProject.tasks                                         
                                                                                
                                                                               
  println "Configurations: " + rootProject.configurations                       
                                                                                
                                                                               
  println "Get task by name: " + rootProject.getTasksByName("uploadBiit",
false)                                                                          
                                                                                
     
  println "Upload task name: " + configurations.biit.uploadTaskName             
                                                                                
                                                                               
  println "Biit artifacts: " + configurations.biit.allArtifacts                 
                                                                                
                                        
}  


Invoking this task generates the following output:


Tasks: [task ':cleanEclipse', task ':cleanEclipseProject', task
':cleanIdea', task ':cleanIdeaModule', task ':cleanIdeaProject', task
':cleanIdeaWorkspace', task ':dependencyReport', task ':eclipse', task
':eclipseProject', task ':idea', task ':ideaModule', task ':ideaProject',
task ':ideaWorkspace', task ':info', task ':projectReport', task
':propertyReport', task ':taskReport']
Configurations: [configuration ':biit']
Get task by name: []
Upload task name: uploadBiit
Biit artifacts: [DefaultPublishArtifact_Decorated
biit-${version}:tar:tar:null]


I can see that the upload task name for the 'biit' configuration is
uploadBiit. Why isn't this task created in the root project? 


--
View this message in context: 
http://gradle.1045684.n5.nabble.com/Auto-created-upload-task-for-custom-configuration-not-created-or-not-visible-tp5089961p5089961.html
Sent from the gradle-user mailing list archive at Nabble.com.

Reply via email to