Commits

Meikel Brandmeyer committed 860ee34

Fix clojarsUpload

Obviously the upload tasks are created after the project configuration
by a rule. So they are not available when the plugin is loaded. We have
to hook into tasks container with a callback when a new task is created.

  • Participants
  • Parent commits 8ab9e25

Comments (0)

Files changed (1)

src/main/groovy/clojuresque/ClojurePlugin.groovy

 import org.gradle.api.Project
 import org.gradle.api.artifacts.dsl.RepositoryHandler
 import org.gradle.api.plugins.JavaPlugin
+import org.gradle.api.plugins.MavenPlugin
 import org.gradle.api.tasks.Copy
 import org.gradle.api.tasks.StopExecutionException
 import org.gradle.api.tasks.Upload
 public class ClojurePlugin implements Plugin<Project> {
     public void apply(Project project) {
         project.apply plugin: JavaPlugin.class
+        project.apply plugin: MavenPlugin.class
 
         project.convention.plugins.clojure = new ClojurePluginConvention()
 
     }
 
     private void configureClojarsUpload(Project project) {
-        project.tasks.withType(Upload.class).each { upload ->
+        project.tasks.whenTaskAdded { upload ->
+            if (!upload instanceof Upload)
+                return
+
             upload.doLast {
                 if (project.clojarsUpload) {
                     String pomName = project.buildDirName + "/" +
                         project.pomDirName + "/" +
-                    "pom-" + upload.configuration.name + ".xml"
+                        "pom-" + upload.configuration.name + ".xml"
 
                     project.pom().writeTo(pomName)
-
                     project.exec {
-                        executable = '/usr/bin/scp',
+                        executable = '/usr/bin/scp'
                         args = project.files(upload.artifacts)*.path +
                             [ project.file(pomName).path,
-                              'clojars@clojars.org:' ]
-                   }
+                              'mb@kotka.de:tmp' ] //'clojars@clojars.org:' ]
+                    }
                 }
             }
         }