Android maven 配置

2020-05-20  本文已影响0人  HockGod_4123

编译完成后点击--》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'

        }

}

}

上一篇下一篇

猜你喜欢

热点阅读