将 Android 库发布到 bintray maven 会产生 2 个独立的工件
Publishing Android library to bintray maven produces 2 separate artifacts
我正在尝试使用 bintray 发布我的 android 库,但我最终在 bintray maven stringx 和 stringx-android-sdk 中得到了两个单独的工件:
https://dl.bintray.com/klimaszewski/stringx/io/stringx/
资源和所有东西都放在这里:
https://dl.bintray.com/klimaszewski/stringx/io/stringx/stringx/1.0.2/
并且 POM 文件被放置在正确的工件中:
https://dl.bintray.com/klimaszewski/stringx/io/stringx/stringx-android-sdk/1.0.2/
我的 bintray 存储库是:stringx 和库名称:stringx-android-sdk
因为那个库无法在我的项目中解析。这里出了什么问题?
build.gradle
buildscript {
repositories {
jcenter()
mavenCentral()
}
dependencies {
classpath 'com.github.dcendents:android-maven-gradle-plugin:2.0'
classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.7.3'
}
}
apply plugin: 'com.android.library'
apply plugin: 'com.github.dcendents.android-maven'
apply plugin: 'com.jfrog.bintray'
ext {
bintrayRepo = 'stringx'
bintrayName = 'stringx-android-sdk'
publishedGroupId = 'io.stringx'
libraryName = 'StringX-SDK'
artifact = 'stringx-android-sdk'
libraryDescription = 'Automatic app Translation for Android'
siteUrl = 'https://www.stringx.io'
gitUrl = 'https://github.com/SzyQ/stringx-android-sdk'
developerId = 'klimaszewski'
developerName = 'Szymon Klimaszewski'
developerEmail = 'klimaszewski.szymon@gmail.com'
licenseName = 'The Apache Software License, Version 2.0'
licenseUrl = 'http://www.apache.org/licenses/LICENSE-2.0.txt'
allLicenses = ["Apache-2.0"]
versionMajor = 1
versionMinor = 0
versionHotFix = 2
libraryVersion = buildVersionName()
}
android {
compileSdkVersion 27
buildToolsVersion "26.0.2"
defaultConfig {
minSdkVersion 16
targetSdkVersion 27
versionCode buildVersionCode()
versionName buildVersionName()
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:support-annotations:27.0.0'
}
def buildVersionName() {
String versionName
if (versionHotFix == null || versionHotFix == 0) {
versionName = versionMajor + "." + versionMinor
} else {
versionName = versionMajor + "." + versionMinor + "." + versionHotFix
}
println "Version name: " + versionName
return versionName
}
def buildVersionCode() {
Integer versionCode
if (versionHotFix == null || versionHotFix == 0) {
versionCode = versionMajor * 10000 + versionMinor * 100
} else {
versionCode = versionMajor * 10000 + versionMinor * 100 + versionHotFix
}
println "Version code: " + versionCode
return versionCode
}
apply from: 'https://raw.githubusercontent.com/nuuneoi/JCenter/master/installv1.gradle'
apply from: 'https://raw.githubusercontent.com/nuuneoi/JCenter/master/bintrayv1.gradle'
Android 模块名称必须匹配 bintray 包,'stringx-android-sdk' 在我的例子中。
所以我不得不在 settings.gradle
中更改模块
include ':stringx-android-sdk'
project(":stringx-android-sdk").projectDir = file("../../stringx")
我正在尝试使用 bintray 发布我的 android 库,但我最终在 bintray maven stringx 和 stringx-android-sdk 中得到了两个单独的工件: https://dl.bintray.com/klimaszewski/stringx/io/stringx/ 资源和所有东西都放在这里: https://dl.bintray.com/klimaszewski/stringx/io/stringx/stringx/1.0.2/
并且 POM 文件被放置在正确的工件中: https://dl.bintray.com/klimaszewski/stringx/io/stringx/stringx-android-sdk/1.0.2/
我的 bintray 存储库是:stringx 和库名称:stringx-android-sdk
因为那个库无法在我的项目中解析。这里出了什么问题? build.gradle
buildscript {
repositories {
jcenter()
mavenCentral()
}
dependencies {
classpath 'com.github.dcendents:android-maven-gradle-plugin:2.0'
classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.7.3'
}
}
apply plugin: 'com.android.library'
apply plugin: 'com.github.dcendents.android-maven'
apply plugin: 'com.jfrog.bintray'
ext {
bintrayRepo = 'stringx'
bintrayName = 'stringx-android-sdk'
publishedGroupId = 'io.stringx'
libraryName = 'StringX-SDK'
artifact = 'stringx-android-sdk'
libraryDescription = 'Automatic app Translation for Android'
siteUrl = 'https://www.stringx.io'
gitUrl = 'https://github.com/SzyQ/stringx-android-sdk'
developerId = 'klimaszewski'
developerName = 'Szymon Klimaszewski'
developerEmail = 'klimaszewski.szymon@gmail.com'
licenseName = 'The Apache Software License, Version 2.0'
licenseUrl = 'http://www.apache.org/licenses/LICENSE-2.0.txt'
allLicenses = ["Apache-2.0"]
versionMajor = 1
versionMinor = 0
versionHotFix = 2
libraryVersion = buildVersionName()
}
android {
compileSdkVersion 27
buildToolsVersion "26.0.2"
defaultConfig {
minSdkVersion 16
targetSdkVersion 27
versionCode buildVersionCode()
versionName buildVersionName()
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:support-annotations:27.0.0'
}
def buildVersionName() {
String versionName
if (versionHotFix == null || versionHotFix == 0) {
versionName = versionMajor + "." + versionMinor
} else {
versionName = versionMajor + "." + versionMinor + "." + versionHotFix
}
println "Version name: " + versionName
return versionName
}
def buildVersionCode() {
Integer versionCode
if (versionHotFix == null || versionHotFix == 0) {
versionCode = versionMajor * 10000 + versionMinor * 100
} else {
versionCode = versionMajor * 10000 + versionMinor * 100 + versionHotFix
}
println "Version code: " + versionCode
return versionCode
}
apply from: 'https://raw.githubusercontent.com/nuuneoi/JCenter/master/installv1.gradle'
apply from: 'https://raw.githubusercontent.com/nuuneoi/JCenter/master/bintrayv1.gradle'
Android 模块名称必须匹配 bintray 包,'stringx-android-sdk' 在我的例子中。
所以我不得不在 settings.gradle
中更改模块include ':stringx-android-sdk'
project(":stringx-android-sdk").projectDir = file("../../stringx")