gpt4 book ai didi

gradle - 在存储库容器上找不到参数 [] 的方法 jcenter()

转载 作者:行者123 更新时间:2023-12-03 07:03:51 28 4
gpt4 key购买 nike

我是 Gradle 和 bintray 的新手。我要发布this project因此 Maven 和 SBT 用户可以轻松使用它。我不是这个包的原作者;它appears to have been abandoned ;我只想发布当前的 HEAD。

~/.gradle/gradle.properties 类似于:

bintrayUser=mslinn
bintrayKey=blahblah

build.gradle 看起来像这样:

buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.0'
}
}
apply plugin: 'com.jfrog.bintray'

allprojects {
apply plugin: 'idea'

group = 'org.jfrog.example.bintray.gradle'
version = '1.0'
}

subprojects {
apply plugin: 'java'
apply plugin: 'maven-publish'
apply plugin: 'com.jfrog.bintray'

sourceCompatibility = 1.6
targetCompatibility = 1.6

dependencies {
testCompile 'junit:junit:4.7'
}

// custom tasks for creating source/javadoc jars
task sourcesJar(type: Jar, dependsOn: classes) {
classifier = 'sources'
from sourceSets.main.allSource
}

task javadocJar(type: Jar, dependsOn: javadoc) {
classifier = 'javadoc'
from javadoc.destinationDir
}

// add javadoc/source jar tasks as artifacts
artifacts {
archives sourcesJar //, javadocJar
}

repositories {
jcenter()
}

publishing {
publications {
mavenJava(MavenPublication) {
if (plugins.hasPlugin('war')) {
from components.web
} else {
from components.java
}

artifact sourcesJar {
classifier "sources"
}

artifact javadocJar {
classifier "javadoc"
}
}
}
}

bintray {
user = bintrayUser //this usually comes form gradle.properties file in ~/.gradle
key = bintrayKey //this usually comes form gradle.properties file in ~/.gradle
publications = ['mavenJava'] // see publications closure
pkg { //package will be created if does not exist
repo = 'Java-WebSocket'
// userOrg = 'myorg' // an optional organization name when the repo belongs to one of the user's orgs
name = 'Java-WebSocket'
desc = 'Current HEAD of abandoned project'
licenses = ['MIT']
labels = ['websocket', 'java']
}
}
}

task wrapper(type: Wrapper) {
gradleVersion = '1.10'
}

问题是这样的:

$ gradle bintrayUpload

FAILURE: Build failed with an exception.

* Where:
Build file '/var/work/experiments/websockets/Java-WebSocket/build.gradle' line: 3

* What went wrong:
A problem occurred evaluating root project 'Java-WebSocket'.
> Could not find method jcenter() for arguments [] on repository container.

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

BUILD FAILED

我正在寻求有关如何解决错误消息的建议,以及有关我可能遇到的任何设置问题的建议,包括将此项目包含到 JCenter 中,以便所有人都可以使用已发布的 bintray 项目。

最佳答案

只是总结一下评论中的讨论:

Gradle 在 1.7 版本中添加了 jcenter() 快捷方式。任何之前的版本都会因此异常而失败。您仍然可以通过将 jcenter 添加为普通的 Maven 存储库来使用它:

repositories {
maven {
url "https://jcenter.bintray.com"
}
....
}

关于gradle - 在存储库容器上找不到参数 [] 的方法 jcenter(),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27470443/

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