在 /library/build.gradle
中添加:
// for publishing to JitPack.io with sources and javadoc
tasks.withType(JavaCompile) {
options.encoding = "UTF-8"
}
task sourcesJar(type: Jar) {
from android.sourceSets.main.java.srcDirs
classifier = 'sources'
}
task javadoc(type: Javadoc) {
failOnError false
source = android.sourceSets.main.java.sourceFiles
classpath += project.files(android.getBootClasspath().join(File.pathSeparator))
classpath += configurations.compile
}
task javadocJar(type: Jar, dependsOn: javadoc) {
classifier = 'javadoc'
from javadoc.destinationDir
}
artifacts {
archives sourcesJar
archives javadocJar
}
这样在使用这个开源库时可以方便的查看文档和源码。像这样:
查看文档参考
https://github.com/GcsSloop/AndroidNote/blob/master/Course/jitpack-javadoc.md
网友评论