美文网首页
Android maven 配置

Android maven 配置

作者: HockGod_4123 | 来源:发表于2020-05-20 15:06 被阅读0次

    编译完成后点击--》Tasks-->upload-->uploadArchives

    //maver

    //生成文档注释

    task androidJavadocs(type: Javadoc) {

    failOnError =false

        source = android.sourceSets.main.java.srcDirs

    //    ext.androidJar = "${android.sdkDirectory}/platforms/${android.compileSdkVersion}/android.jar"

    //    classpath += files(ext.androidJar)

        classpath +=project.files(android.getBootClasspath().join(File.pathSeparator))

    android.libraryVariants.all { variant ->

    if (variant.name =='release') {

    owner.classpath += variant.getJavaCompile().classpath

    }

    }

    exclude'**/R.html','**/R.*.html','**/index.html'

        options.encoding"UTF-8"

        options.charSet"UTF-8"

    }

    //将文档打包成jar

    task androidJavadocsJar(type: Jar,dependsOn: androidJavadocs) {

    classifier ='javadoc'

        from androidJavadocs.destinationDir

    }

    //将源码打包

    task androidSourcesJar(type: Jar) {

    classifier ='sources'

        from android.sourceSets.main.java.srcDirs

    }

    //包含文档和源码的aar

    artifacts {

    archivesandroidSourcesJar

        archivesandroidJavadocsJar

    }

    version ='1.0.1'

    uploadArchives {

    repositories {

    mavenDeployer {

    repository(url:"http://192.168.16.197:9090/nexus/content/repositories/releases") {

    //如果使用的是maven私服,一般都需要账号密码

                    authentication(userName :"",password:"")

    }

    pom.groupId ='com.peng.ppscalelibrary'

                pom.artifactId ='01'

                pom.version =version

                pom.packaging ='aar'

            }

    }

    }

    相关文章

      网友评论

          本文标题:Android maven 配置

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