1

我是 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 解析器正在被使用,但我没有设置 ivy 以便在任何地方使用。有人可以指出我在这里做错了什么吗?

4

1 回答 1

2

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

于 2013-09-13T22:54:43.300 回答