Artifactory - gradle:无法发布配置'archives'

时间:2013-09-13 22:29:13

标签: build gradle dependency-management artifactory

我是神话般的新手gradle并且我正在尝试设置它们并在发布gradle工件时出现以下错误:

15:14:44.544 [ERROR] [org.gradle.BuildExceptionReporter] Caused by: java.lang.UnsupportedOperationException
15:14:44.544 [ERROR] [org.gradle.BuildExceptionReporter]    at org.gradle.api.internal.artifacts.repositories.LegacyDependencyResolver.abortPublishTransaction(LegacyDependencyResolver.java:150)
15:14:44.544 [ERROR] [org.gradle.BuildExceptionReporter]    at org.gradle.api.internal.artifacts.ivyservice.IvyResolverBackedModuleVersionPublisher.publish(IvyResolverBackedModuleVersionPublisher.java:59)
15:14:44.544 [ERROR] [org.gradle.BuildExceptionReporter]    at org.gradle.api.internal.artifacts.ivyservice.DefaultIvyDependencyPublisher$Publication.publishTo(DefaultIvyDependencyPublisher.java:77)
15:14:44.545 [ERROR] [org.gradle.BuildExceptionReporter]    at org.gradle.api.internal.artifacts.ivyservice.DefaultIvyDependencyPublisher.publish(DefaultIvyDependencyPublisher.java:48)
15:14:44.545 [ERROR] [org.gradle.BuildExceptionReporter]    at org.gradle.api.internal.artifacts.ivyservice.IvyBackedArtifactPublisher.publish(IvyBackedArtifactPublisher.java:63)
15:14:44.545 [ERROR] [org.gradle.BuildExceptionReporter]    at org.gradle.api.tasks.Upload.upload(Upload.java:82)
15:14:44.545 [ERROR] [org.gradle.BuildExceptionReporter]    ... 79 more
15:14:44.545 [ERROR] [org.gradle.BuildExceptionReporter] 

我的build.gradle

中有以下配置
apply plugin:'java'
apply plugin:'artifactory'
apply plugin:'maven'

buildscript {
    repositories {
        maven {
            url 'http://localhost:9081/artifactory/plugins-release'
            credentials {
                username = "${artifactory_user}"
                password = "${artifactory_password}"
            }
        }
    }
    dependencies {
        classpath(group: 'org.jfrog.buildinfo', name: 'build-info-extractor-gradle', version: '2.0.9')
    }
}

artifactory {
    contextUrl = "${artifactory_contextUrl}"   //The base Artifactory URL if not overridden by the publisher/resolver
    publish {
        repository {
            repoKey = 'libs-release-local'
            username = "${artifactory_user}"
            password = "${artifactory_password}"
            maven = true

        }
    }
    resolve {
        repository {
            repoKey = 'libs-release'
            username = "${artifactory_user}"
            password = "${artifactory_password}"
            maven = true
        }
    }
}
........
........
........

def myJar = file('build/libs/myjar-1.0.jar')

artifacts {
    archives myJar
}

uploadArchives {
  repositories {
    mavenRepo url: "http://localhost:9082/artifactory/libs-release-local";

    repositories.mavenDeployer {
      repository(url: "http://localhost:9082/artifactory/libs-release-local") {
        authentication(userName: "${artifactory_user}", password: "${artifactory_password}")
      }
      pom.version = versionNumber
      pom.artifactId = artifactId
      pom.groupId = groupId
    }
  }
}

我可以看到异常使用Ivy解析器,但我没有设置常春藤可以在任何地方使用。有人可以指出我在这里做错了什么吗?

1 个答案:

答案 0 :(得分:2)

使用Artifactory插件时,无需配置uploadArchives任务。该插件为您配置它。