gpt4 book ai didi

java - Gradle 和 Bintray 插件 : Cannot cast _Decorated

转载 作者:行者123 更新时间:2023-11-30 02:15:23 25 4
gpt4 key购买 nike

在尝试使用 Gradle Bintray 插件在 Bintray 上发布我的一组纯 Java 库时,我在运行“bintrayUpload”任务时收到以下错误:

Caused by: org.codehaus.groovy.runtime.typehandling.GroovyCastException: Cannot cast object 'task ':bintrayUpload'' with class 'com.jfrog.bintray.gradle.BintrayUploadTask_Decorated' to class 'com.jfrog.bintray.gradle.BintrayUploadTask'
at com.jfrog.bintray.gradle.BintrayUploadTask.getCachedRepositories(BintrayUploadTask.groovy:663)
at com.jfrog.bintray.gradle.BintrayUploadTask_Decorated.getCachedRepositories(Unknown Source)
at com.jfrog.bintray.gradle.BintrayUploadTask.getRepository(BintrayUploadTask.groovy:683)
at com.jfrog.bintray.gradle.BintrayUploadTask.checkPackageAlreadyCreated(BintrayUploadTask.groovy:510)
at com.jfrog.bintray.gradle.BintrayUploadTask$_bintrayUpload_closure5.doCall(BintrayUploadTask.groovy:255)
at com.jfrog.bintray.gradle.BintrayUploadTask$_bintrayUpload_closure5.doCall(BintrayUploadTask.groovy)
at com.jfrog.bintray.gradle.BintrayUploadTask.bintrayUpload(BintrayUploadTask.groovy:470)

发布任务完美运行;只是 Bintray 上传失败。

每个库都是根项目中的子模块。

我的子模块之一中 Gradle 文件的 Maven/Bintray 部分如下所示:

//Bintray
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.7.3'
}
}
def bintrayPropertiesFile = rootProject.file("bintray.properties")
def bintrayProperties = new Properties()
bintrayProperties.load(new FileInputStream(bintrayPropertiesFile))


apply plugin: 'maven-publish'
publishing {
publications {
mavenJava(MavenPublication){
from components.java
groupId bintrayProperties['bintrayRepository']
artifactId project.name
version rootProject.libraryVersion
}
}
}


apply plugin: 'com.jfrog.bintray'
bintray {
user = bintrayProperties['bintrayUser']
key = bintrayProperties['bintrayKey']
publications = ['mavenJava']
pkg {
repo = bintrayProperties['bintrayRepository']
name = project.name
userOrg = bintrayProperties['bintrayOrganization']
licenses = [bintrayProperties['bintrayLicense']]
vcsUrl = bintrayProperties['bintrayVcs']
version {
name = rootProject.libraryVersion
released = new Date()
}
}
}

我在 Gradle 构建文件中做错了什么?提前致谢。

最佳答案

将以下内容添加到根项目的 build.gradle 中:

buildscript {
...
dependencies {
...
classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.8.0'
}
}
apply plugin: 'com.jfrog.bintray'

我很想知道为什么这能解决这个问题,但它确实如此。

关于java - Gradle 和 Bintray 插件 : Cannot cast _Decorated,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48695508/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com