这个还是比较头疼的,jiko我换了各种写法都有问题,显然他们系统自带了一个gradle,我设置弄一个gradle文件而且是最新版也没用找不到 'java-library'的错误
于是就开始研究以前成功过的,其实也非常简单的jcenter上传了
//确保可以单独运行本项目
buildscript {
repositories {
mavenCentral()
// maven { url 'https://jitpack.io' }
// maven { url 'https://maven.google.com/' }
// maven { url 'https://dl.google.com/dl/android/maven2/' }
jcenter()
google()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.0.1'
classpath 'com.github.dcendents:android-maven-gradle-plugin:1.5'
classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.0'
}
}
apply plugin: 'java-library'
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
compileOnly files('libs/android.jar')//不编译进去。
}
//android studio 错误: 编码GBK的不可映射字符
tasks.withType(JavaCompile) {
options.encoding = "UTF-8"
}
sourceCompatibility = "1.7"
targetCompatibility = "1.7"
apply plugin: 'com.github.dcendents.android-maven'
apply plugin: 'com.jfrog.bintray'
def siteUrl = 'https://qssq666.cn' // 修改为你的项目的主页
def gitUrl = 'https://github.com/qssq/robotsdk' // 修改为你的Git仓库的ur
group = "cn.qssq666" // Maven Group ID for the artifact,一般填你唯一的包名
install {
repositories.mavenInstaller {
// This generates POM.xml with proper parameters
pom {
project {
packaging 'aar'
// Add your description here qssq
name 'auto extand qssq for Android.' //项目描述
url siteUrl
// Set your license
licenses {
license {
name 'The Apache Software License, Version 2.0'
url 'http://www.apache.org/licenses/LICENSE-2.0.txt'
}
}
developers {
developer {
id 'luozheng' //填写的一些基本信息
name 'luozheng1'
email 'qssq666@foxmail.com'
}
}
scm {
connection gitUrl
developerConnection gitUrl
url siteUrl
}
}
}
}
}
tasks.withType(Javadoc) { //防止doc错误
options.addStringOption('Xdoclint:none', '-quiet')
options.addStringOption('encoding', 'UTF-8')
options.addStringOption('charSet', 'UTF-8')
}
task sourcesJar(type: Jar) {
// from android.sourceSets.main.java.srcDirs
from sourceSets.main.allSource
classifier = 'sources'
}
task javadocJar(type: Jar, dependsOn: javadoc) {
classifier = 'javadoc'
from 'build/docs/javadoc'
}
artifacts {
archives javadocJar
archives sourcesJar
}
Properties properties = new Properties()
properties.load(project.file('..\\local.properties').newDataInputStream())
bintray {
user = properties.getProperty("bintray.user")
key = properties.getProperty("bintray.apikey")
configurations = ['archives']
pkg {
repo = "maven"
name = "extend-imageview" //发布到JCenter上的项目名字
websiteUrl = siteUrl
vcsUrl = gitUrl
licenses = ["Apache-2.0"]
publish = true
}
}
在项目根目录打开gradle控制台
gradlew robot_sdk:clean robot_sdk:build bintrayUpload -PbintrayUser=luozheng -PbintrayKey=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx -PdryRun=false
我这里是执行子目录的打包,这种姿势也是挑战难度了.不然早就搞定了,jiko都搞不定这玩意
里面比较关键的是要修改android的姿势为java的姿势,表示网上根本找不到java的姿势
上传成功之后再次上传提示:
> Could not upload to 'https://api.bintray.com/content/luozheng/maven/extend-imageview/unspecified/cn/qssq666/robot_sdk/unspecified/robot_sdk-unspecified.jar': HTTP/1.1 409 Conflict
应该是一件上传过了
https://www.jianshu.com/p/41e4215b1801