我有一个简单的项目,我试图通过 BinTray 发布到 Maven,但出现错误。
我已按照指南发布到 bintray,并且似乎已设置好 BinTray,并且可以访问 Sonatype。签名/等等,一切似乎都很好。
当我运行“./gradlew bintrayUpload”时,出现错误,但 Artifact 确实显示在 bintray 上。但是我收到各种 POM 错误。
adams-MBP:UsedUtil adamhammer2$ ./gradlew clean install
:clean
:compileJava
warning: [options] bootstrap class path not set in conjunction with -source 1.7
Note: /Users/adamhammer2/git/UsedUtil/src/main/java/com/mysaasa/usedutil/CallKeyGenerator.java uses unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
1 warning
:processResources UP-TO-DATE
:classes
:jar
:javadoc
:javadocJar
:sourcesJar
:install
BUILD SUCCESSFUL
Total time: 7.233 secs
adams-MBP:UsedUtil adamhammer2$ ./gradlew bintrayUpload
:compileJava UP-TO-DATE
:processResources UP-TO-DATE
:classes UP-TO-DATE
:jar UP-TO-DATE
:javadoc UP-TO-DATE
:javadocJar UP-TO-DATE
:sourcesJar UP-TO-DATE
:install
:bintrayUpload FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':bintrayUpload'.
> Could not upload to 'https://api.bintray.com/content/adamhammer/maven/used-util/0.9.1/com/mysaasa/used_util/UsedUtil/0.9.1/UsedUtil-0.9.1.pom': HTTP/1.1 400 Bad Request [message:Unable to upload files: Maven group, artifact or version defined in the pom file do not match the file path 'com/mysaasa/used_util/UsedUtil/0.9.1/UsedUtil-0.9.1.pom']
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
BUILD FAILED
Total time: 12.923 secs
Github项目是https://github.com/ahammer/UsedUtil
build.gradle 文件是
buildscript {
repositories {
mavenCentral()
jcenter()
}
dependencies {
classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.4'
classpath 'com.github.dcendents:android-maven-gradle-plugin:1.3'
}
}
apply plugin: 'java'
sourceCompatibility = 1.7
repositories {
mavenCentral()
}
dependencies {
testCompile group: 'junit', name: 'junit', version: '4.+'
}
ext {
bintrayRepo = 'maven'
bintrayName = 'used-util'
publishedGroupId = 'com.mysaasa.used_util'
libraryName = 'UsedUtil'
artifact = 'usedutil'
libraryDescription = 'A Library for tracking usage in java projects'
siteUrl = 'http://ahammer.github.io/UsedUtil'
gitUrl = 'https://github.com/ahammer/UsedUtil.git'
libraryVersion = '0.9.1'
developerId = 'adamhammer'
developerName = 'Adam Hammer'
developerEmail = 'adamhammer2@gmail.com'
licenseName = 'The Apache Software License, Version 2.0'
licenseUrl = 'http://www.apache.org/licenses/LICENSE-2.0.txt'
allLicenses = ["Apache-2.0"]
}
apply from: 'https://raw.githubusercontent.com/nuuneoi/JCenter/master/installv1.gradle'
apply from: 'https://raw.githubusercontent.com/nuuneoi/JCenter/master/bintrayv1.gradle'
发布后我收到错误,但是在 BinTray 中它注册了上传。但是,当我单击添加到 JCenter 时,我收到另一个错误“- 将 POM 文件添加到最新版本的包中。”
最佳答案
我没有使用第 3 方脚本和过时的插件,而是按照指南进行操作 在这里https://github.com/bintray/gradle-bintray-plugin
这生成了一个正确的 pom 文件并发布到 bintray 并使我的包与 jcenter 兼容。
对于工作的 build.gradle,您可以在我的 github 上查看工作版本。
关于java - 无法使用 Gradle 通过 BinTray 将 Java 项目发布到 Maven,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38170033/