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

}

}

}

Logo

华为开发者空间,是为全球开发者打造的专属开发空间,汇聚了华为优质开发资源及工具,致力于让每一位开发者拥有一台云主机,基于华为根生态开发、创新。

更多推荐