2016-07-03 50 views
1

我有一个简单的项目,我试图通过BinTray发布到Maven,但一直在收到错误。无法通过BinTray与Gradle发布Java项目到Maven

我遵循指南发布到bintray,似乎有BinTray所有设置,以及访问Sonatype。签署/等,都显得很好。

当我运行“./gradlew bintrayUpload”时,出现一个错误,但工件在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 = '[email protected]' 

    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文件添加到最新版本的包中。”

+0

也许这是bintray插件中的一个错误。它似乎尝试上传到'used_util',但您将名称设置为'used-util'。您应该尝试插件的最新版本和/或避免您的工件名称中包含任何非单词字符。 – dpr

回答

0

而不是使用第三方脚本和过时插件的,我也跟着指导 这里https://github.com/bintray/gradle-bintray-plugin

这产生一个适当的POM文件并发布到bintray,使我的包jcenter兼容。

对于一个工作的build.gradle,你可以看看我的github的工作版本。

+2

你的github的工作版本在哪里? –

相关问题