1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465 |
- // 打包源代码,为了方便查看源码及调试,把源码也上传到nexus仓库中
- task sourcesJar(type: Jar, dependsOn: classes) {
- archiveClassifier = 'sources'
- from sourceSets.main.allSource
- }
- // 打javadoc包,为了方便查看注释,需要把javadoc也上传到nexus仓库中
- task javadocJar(type: Jar, dependsOn: javadoc) {
- classifier = 'javadoc'
- from javadoc.destinationDir
- }
- tasks.withType(Javadoc) {
- options.addStringOption('Xdoclint:none', '-quiet')
- options.addStringOption('encoding', 'UTF-8')
- options.addStringOption('charSet', 'UTF-8')
- }
- artifacts {
- archives sourcesJar
- archives javadocJar
- }
- apply plugin: 'maven-publish'
- publishing {
- publications {
- maven(MavenPublication) {
- groupId this.group
- artifactId project.name
- if ("unspecified".equals(project.version)) {
- version parent.version
- } else {
- version project.version
- }
- from components.java
- versionMapping {
- usage('java-api') {
- fromResolutionOf('runtimeClasspath')
- }
- usage('java-runtime') {
- fromResolutionResult()
- }
- }
- artifact sourcesJar
- }
- }
- repositories {
- maven {
- def version;
- if ("unspecified".equals(project.version)) {
- version = parent.version
- } else {
- version = project.version
- }
- if (version.endsWith('-SNAPSHOT')) {
- url = REPOSITORY_SNAPSHOT_URL
- } else {
- url = REPOSITORY_RELEASE_URL
- }
- credentials {
- username '7Cz3wG'
- password 'CVTGo03cyU'
- }
- }
- }
- }
|