Last active
July 11, 2021 01:11
-
-
Save twiceyuan/6823979dd4eba441df36cc0bd65b3eb9 to your computer and use it in GitHub Desktop.
[Gradle 配置 上传 source.jar] #Gradle
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// build a jar with source files | |
task sourcesJar(type: Jar) { | |
from android.sourceSets.main.java.srcDirs | |
archiveClassifier.set('sources') | |
} | |
task javadoc(type: Javadoc) { | |
failOnError false | |
source = android.sourceSets.main.java.sourceFiles | |
classpath += project.files(android.getBootClasspath().join(File.pathSeparator)) | |
classpath += configurations.compile | |
} | |
// build a jar with javadoc | |
task javadocJar(type: Jar, dependsOn: javadoc) { | |
archiveClassifier.set('javadoc') | |
from javadoc.destinationDir | |
} | |
artifacts { | |
archives sourcesJar | |
archives javadocJar | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 如果需要制定上传的仓库和 artifact 信息需要加这个 | |
uploadArchives { | |
repositories.mavenDeployer { | |
repository(url: "file://$rootDir/repo") | |
pom.groupId = "com.ohosure" | |
pom.artifactId = "component" | |
pom.version = "1.0" | |
} | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment