task sourcesJar(type: Jar, dependsOn: classes) {
classifier = 'sources'
from sourceSets.main.allSource
}
task javadocJar(type: Jar, dependsOn: javadoc) {
classifier = 'javadoc'
from javadoc.destinationDir
}
artifacts {
archives sourcesJar
archives javadocJar
}
tasks.withType(Compile) {
options.encoding = 'UTF-8'
}
tasks.withType(Javadoc) {
options.encoding = 'UTF-8'
}
uploadArchives {
repositories {
mavenDeployer {
repository(url: 'http://192.168.160.187:8081/nexus/content/repositories/releases') {
authentication(userName: "admin", password: "tznexus")
}
snapshotRepository(url: 'http://192.168.160.187:8081/nexus/content/repositories/snapshots') {
authentication(userName: "admin", password: "tznexus")
}
}
}
}
之前上传一直不传sources和javadoc包,似乎是因为uploadArchives没写在build.gradle里而是引用的(待确认)