美文网首页
发布Android开源库到JitPack.io附带文档和源码

发布Android开源库到JitPack.io附带文档和源码

作者: By_syk | 来源:发表于2017-07-04 13:17 被阅读39次

    /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

    相关文章

      网友评论

          本文标题:发布Android开源库到JitPack.io附带文档和源码

          本文链接:https://www.haomeiwen.com/subject/jmathxtx.html