将编译更改为实现后,pom.xml不包括依赖项

时间:2018-10-26 11:54:12

标签: android maven gradle android-gradle pom.xml

我有一个gradle库,说是ABC,它已内置到aar文件中并上传到bintray。在更新gradle版本(即低于3.0并为所有依赖项使用compile)之前,pom.xml包含所有依赖项,可以正常工作。包括任何依赖项信息,我发现类未找到异常。

PFA库gradle文件:

apply plugin: 'com.android.library'
apply plugin: 'com.jfrog.bintray'
apply plugin: 'com.github.dcendents.android-maven'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
apply plugin: 'kotlin-kapt'

repositories {
    maven { url 'https://maven.fabric.io/public' }
}

dependencies {
    implementation fileTree(include: ['*.jar'], dir: 'libs')
    androidTestImplementation('com.android.support.test.espresso:espresso-core:2.2.2', {
        exclude group: 'com.android.support', module: 'support-annotations'
    })
    implementation 'com.google.code.gson:gson:2.8.2'
    implementation 'com.android.support:appcompat-v7:27.1.1'
    implementation files('libs/Java-WebSocket-1.3.9.jar')
    implementation 'com.android.support:recyclerview-v7:27.1.1'
    implementation 'com.android.support:cardview-v7:27.1.1'
    implementation 'com.android.support:design:27.1.1'
    implementation 'com.squareup.retrofit2:retrofit:2.4.0'
    implementation 'com.squareup.retrofit2:converter-gson:2.4.0'
    implementation 'com.squareup.okhttp3:logging-interceptor:3.9.1'
    implementation 'com.github.bumptech.glide:glide:4.7.1'
    annotationProcessor 'com.github.bumptech.glide:compiler:4.6.1'
    implementation 'io.paperdb:paperdb:2.6'
    implementation 'org.jsoup:jsoup:1.10.3'
    implementation 'org.webrtc:google-webrtc:1.0.24465'
    implementation 'org.jetbrains.kotlin:kotlin-reflect:1.2.70'
    implementation 'org.apache.httpcomponents:httpclient-android:4.3.5.1'
    implementation('org.apache.httpcomponents:httpmime:4.3') {
        exclude module: "httpclient"
    }
}

android {
    compileSdkVersion 28
    buildToolsVersion '28.0.3'
    useLibrary 'org.apache.http.legacy'
    configurations {
        all*.exclude module: 'servlet-api'
    }
    defaultConfig {
        minSdkVersion 16
        targetSdkVersion 28
        versionCode 174
        versionName "1.74"

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

        group = 'com.abc' // package name
        version = '1.73.2.2' // Change this to match your version number
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
        debug {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
        kotlinOptions.jvmTarget = "1.8"
    }

    androidExtensions {
        experimental = true
    }
}

task generateSourcesJar(type: Jar) {
    from android.sourceSets.main.java.srcDirs
    classifier 'sources'
}

task generateJavadocs(type: Javadoc) {
    failOnError false
    source = android.sourceSets.main.java.srcDirs
    classpath += project.files(android.getBootClasspath()
            .join(File.pathSeparator))
}

task generateJavadocsJar(type: Jar) {
    from generateJavadocs.destinationDir
    classifier 'javadoc'
}
generateJavadocsJar.dependsOn generateJavadocs
artifacts {
    archives generateJavadocsJar
    archives generateSourcesJar
}

bintray {
    user = 'XXXX'
    key = 'XXXXXX'
    pkg {
        repo = 'abc'
        name = 'com.abc'

        version {
            name = '1.73.2.2'
            desc = 'This is the test build'
            released = new Date()
            vcsTag = '1.73.2.2'
        }

        licenses = ['Apache-2.0']
        vcsUrl = 'https://git.demolibs.in/abc/abc-android.git'
    }
    configurations = ['archives']
}

生成的pom.xml:

<?xml version="1.0" encoding="UTF-8"?>
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <modelVersion>4.0.0</modelVersion>
  <groupId>com.abc</groupId>
  <artifactId>abc</artifactId>
  <version>1.73.2.2</version>
  <packaging>aar</packaging>
</project>

也使用api代替实现,但在pom.xml文件中未找到任何更改。您将如何使用库并使gradle下载其依赖项?

谢谢

0 个答案:

没有答案