gpt4 book ai didi

android - 部署到 Artifact 后不包含外部依赖项

转载 作者:行者123 更新时间:2023-11-29 15:40:09 24 4
gpt4 key购买 nike

我开发了小型 mvp 库,其中包含一些依赖项,如 butterknife 和 glide,但是在它已经部署到我的私有(private) Artifact 之后,所有依赖项都没有包含在我的库中,因此在使用时我的项目中没有解决所有依赖项这个图书馆。我是这个神器的新手,我是否遗漏了什么?

这是我的根 build.gradle :

buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.2.3'

// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
classpath "org.jfrog.buildinfo:build-info-extractor-gradle:4.0.1"
classpath 'com.neenbedankt.gradle.plugins:android-apt:1.8'
}
}

allprojects {
repositories {
jcenter()
}
}

task clean(type: Delete) {
delete rootProject.buildDir
}

这是我的 build.gradle 模块:

apply plugin: 'com.android.library'
apply plugin: 'com.jfrog.artifactory'
apply plugin: 'maven-publish'
apply plugin: 'me.tatarka.retrolambda'

def libraryGroupId = 'com.pixilapps.pixilframework'
def libraryArtifactId = 'mvp'
def libraryVersion = '1.0.0'

publishing {
publications {
aar(MavenPublication) {
groupId libraryGroupId
version libraryVersion
artifactId libraryArtifactId
artifact("$buildDir/outputs/aar/${artifactId}-release.aar")
}
}
}

artifactory {
contextUrl = 'http://my.lib.web/artifactory'
publish {
repository {
repoKey = 'libs-release-local'

username = artifactory_username
password = artifactory_password
}
defaults {
publications('aar')
publishArtifacts = true

properties = ['qa.level': 'basic', 'q.os': 'android', 'dev.team': 'core']
publishPom = true
}
}
}

buildscript {
repositories {
mavenCentral()
jcenter()
}

dependencies {
classpath 'me.tatarka:gradle-retrolambda:3.3.1'
}
}

repositories {
mavenCentral()
jcenter()
maven { url "https://clojars.org/repo/" }
maven { url "https://jitpack.io" }
maven {
url "https://s3.amazonaws.com/repo.commonsware.com"
}
maven { url "https://oss.sonatype.org/content/repositories/snapshots/" }
maven {
url "http://dl.bintray.com/glomadrian/maven"
}
}

android {
compileSdkVersion 25
buildToolsVersion "25.0.0"

defaultConfig {
minSdkVersion 17
targetSdkVersion 25
versionCode 1
versionName "1.0"

testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"

}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8.toString()
targetCompatibility JavaVersion.VERSION_1_8.toString()
}
}

dependencies {
final PLAY_SERVICES_VERSION = '9.6.1'
final DEXMAKER_VERSION = '1.4'
final HAMCREST_VERSION = '1.3'
final ESPRESSO_VERSION = '2.2.1'
final RUNNER_VERSION = '0.4'
final AUTO_VALUE_VERSION = '1.3'
final AUTO_VALUE_GSON_VERSION = '0.4.2'
final SUPPORT_LIBRARY_VERSION = '25.1.0'
final RETROFIT_VERSION = '2.1.0'
final BUTTERKNIFE_VERSION = '7.0.1'
compile fileTree(dir: 'libs', include: ['*.jar'])
compile "com.android.support:appcompat-v7:$SUPPORT_LIBRARY_VERSION"
compile "com.android.support:recyclerview-v7:$SUPPORT_LIBRARY_VERSION"
compile "com.android.support:cardview-v7:$SUPPORT_LIBRARY_VERSION"
compile "com.android.support:support-annotations:$SUPPORT_LIBRARY_VERSION"
compile "com.squareup.retrofit2:retrofit:$RETROFIT_VERSION"
compile "com.squareup.retrofit2:converter-gson:$RETROFIT_VERSION"
compile "com.squareup.retrofit2:adapter-rxjava:$RETROFIT_VERSION"
compile 'com.github.bumptech.glide:glide:3.7.0'
compile 'io.reactivex:rxandroid:1.2.1'
compile 'io.reactivex:rxjava:1.1.6'
compile 'com.jakewharton.timber:timber:4.1.2'
compile 'com.squareup.okhttp3:logging-interceptor:3.4.1'
compile 'com.squareup.okhttp3:okhttp:3.4.1'
compile 'com.vistrav:ask:2.4'
compile "com.jakewharton:butterknife:$BUTTERKNIFE_VERSION"
compile 'com.michaelpardo:activeandroid:3.1.0-SNAPSHOT'
compile 'net.danlew:android.joda:2.9.3.1'
compile 'com.pixplicity.easyprefs:library:1.7'
}

最佳答案

您可以在publishing block 中使用pom.withXml,如here 所述(找到关于 pom.withXml here 的官方文档)。

我猜它看起来像这样:

publishing {
publications {
aar(MavenPublication) {
groupId libraryGroupId
version = libraryVersion
artifactId libraryArtifactId
artifact("$buildDir/outputs/aar/${project.getName()}-release.aar")

pom.withXml {
def dependencies = asNode().appendNode('dependencies')
configurations.getByName("_releaseCompile").getResolvedConfiguration().getFirstLevelModuleDependencies().each {
def dependency = dependencies.appendNode('dependency')
dependency.appendNode('groupId', it.moduleGroup)
dependency.appendNode('artifactId', it.moduleName)
dependency.appendNode('version', it.moduleVersion)
}
}
}
}
}

关于android - 部署到 Artifact 后不包含外部依赖项,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41868670/

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