将源附加到 kotlin 库项目不会显示在 AS 中 [英] Attach sources to kotlin library project don't show up in AS

查看:29
本文介绍了将源附加到 kotlin 库项目不会显示在 AS 中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想将源代码附加到一个 kotlin 库项目,看起来我成功了,因为我现在有源文件罐:

I want to attach the sources to an kotlin library project and it looks I succeeded as I have the source-jars now in here:

https://jitpack.io/com/github/walleth/kethereum/bip44/0.21/

我之前的版本没有导出源 - 所以我认为它是成功的.

the version before I did not export the sources - so I thought it is successful.

https://jitpack.io/com/github/walleth/kethereum/bip44/0.20/

不幸的是,AS 没有显示来源.我是这样生成它们的:

Unfortunately AS does not show the sources. I am generating them like this:

allprojects {
    repositories {
        jcenter()
        maven { url 'https://jitpack.io' }
    }

    apply plugin: "kotlin"
    apply plugin: "jacoco"
    apply plugin: "maven"
    apply plugin: "com.github.ben-manes.versions"

    dependencies {
        compile "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"

        testCompile 'org.assertj:assertj-core:3.8.0'
        testCompile 'junit:junit:4.12'
    }

    task sourcesJar(type: Jar, dependsOn: classes) {
        classifier = 'sources'
        from sourceSets.main.allSource
    }

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

    artifacts {
        archives sourcesJar
        archives javadocJar
    }
}

源文件也包含 kotlin 文件.这一切都在这个项目中:https://github.com/walleth/kethereum

Also the source-jars contain the kotlin files. It is all in this project: https://github.com/walleth/kethereum

推荐答案

这就是我们为 Maven Publication 提供的.

This is what we have for Maven Publication.

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

然后你可以使用artifact androidSourcesJar.

这篇关于将源附加到 kotlin 库项目不会显示在 AS 中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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