在 artifactory repo 上发布带有 javadoc 的 .aar 文件 [英] Publish .aar file with javadocs attached on artifactory repo

查看:25
本文介绍了在 artifactory repo 上发布带有 javadoc 的 .aar 文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试通过 artifactory gradle puglin 将带有 javadoc 文件的 AAR 发布到我的 maven 存储库.

I'm trying to publish an AAR with javadoc file to my maven repo through artifactory gradle puglin.

aar 文件正在成功上传,但我的 javadoc 没有.我可以使用哪个脚本上传我的 javadoc?.

The aar file is doing uploaded with success, but i the javadoc don't. Which script can i use to upload my javadocs?.

这是我的 build.gradle 代码

This is my build.gradle code

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

def packageName = 'br.com.lexsis.libtest'
def libraryVersion = '0.0.1-SNAPSHOT'

android {
    compileSdkVersion 23
    buildToolsVersion "23.0.0"

    defaultConfig {
        minSdkVersion 15
        targetSdkVersion 23
        versionCode 1
        versionName "1.0"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    compile 'com.android.support:appcompat-v7:23.0.0'
}

publishing {
    publications {
        aar(MavenPublication) {
            groupId packageName
            version = libraryVersion
            artifactId project.getName()

            // Tell maven to prepare the generated "*.aar" file for publishing
            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)
                }
            }
        }
    }
}

artifactory {
    contextUrl = "${artifactory_contextUrl}"
    publish {
        repository {
            // The Artifactory repository key to publish to
            repoKey = libraryVersion.endsWith('SNAPSHOT') ? 'libs-snapshot-local' : 'libs-release-local'

            username = "${artifactory_user}"
            password = "${artifactory_password}"
        }
        defaults {
            // Tell the Artifactory Plugin which artifacts should be published to Artifactory.
            publications('aar')
            publishArtifacts = true

            // Properties to be attached to the published artifacts.
            properties = ['qa.level': 'basic', 'dev.team': 'core']
            // Publish generated POM files to Artifactory (true by default)
            publishPom = true
        }
    }
}

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

task androidJavadocsJar(type: Jar, dependsOn: androidJavadocs) {
    classifier = 'javadoc'
    from androidJavadocs.destinationDir
}

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

artifacts {
    archives androidSourcesJar
    archives androidJavadocsJar
}

推荐答案

您的出版物仅包含 aar 文件:

Your publication only includes the aar file:

artifact("$buildDir/outputs/aar/${project.getName()}-release.aar")

添加另一个工件 - androidJavadocsJar 任务的输出:

Add another artifact - the output of the androidJavadocsJar task:

artifact androidJavadocsJar

如果需要,请对源 jar 重复.

Repeat for sources jar, if you want.

这篇关于在 artifactory repo 上发布带有 javadoc 的 .aar 文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆