在Kotlin图书馆项目中附加资源不会在AS中显示 [英] Attach sources to kotlin library project don't show up in 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
}
}
此外,源jar包含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发布所具有的功能.
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屋!