gradle 打包 Spring boot starter项目

打包上传到jcenter,下面是我的一个项目的完整build,https://github.com/jiangtj-lab/commonmark-spring-starter

plugins {
    id 'org.springframework.boot' version '2.3.1.RELEASE'
    id 'io.spring.dependency-management' version '1.0.9.RELEASE'
    id 'java-library'
    id 'com.jfrog.bintray' version "1.8.5"
    id 'maven-publish'
}

group = 'com.jiangtj.common'
version = '0.0.9'
sourceCompatibility = '8'

configurations {
    compileOnly {
        extendsFrom annotationProcessor
    }
}

repositories {
    mavenCentral()
}

dependencies {
    api 'com.atlassian.commonmark:commonmark:0.15.2'
    implementation 'org.springframework.boot:spring-boot-starter'
    compileOnly 'org.projectlombok:lombok'
    annotationProcessor 'org.springframework.boot:spring-boot-configuration-processor'
    annotationProcessor 'org.projectlombok:lombok'
    testImplementation 'com.atlassian.commonmark:commonmark-ext-task-list-items:0.15.2'
    testImplementation('org.springframework.boot:spring-boot-starter-test') {
        exclude group: 'org.junit.vintage', module: 'junit-vintage-engine'
    }
}

test {
    useJUnitPlatform()
}

java {
    withJavadocJar()
    withSourcesJar()
}

jar {
    enabled = true
}

javadoc {
    if(JavaVersion.current().isJava9Compatible()) {
        options.addBooleanOption('html5', true)
    }
}

// Create the publication with the pom configuration:
publishing {
    publications {
        maven(MavenPublication) {
            artifactId = project.getName()
            from components.java
            //artifact bootJar
            versionMapping {
                usage('java-api') {
                    fromResolutionOf('runtimeClasspath')
                }
                usage('java-runtime') {
                    fromResolutionResult()
                }
            }
            pom {
                name = 'commonmark-spring-starter'
                description = 'A spring starter wapper for commonmark'
                url = 'https://github.com/jiangtj-lab/commonmark-spring-starter'
                licenses {
                    license {
                        name = 'The Apache License, Version 2.0'
                        url = 'http://www.apache.org/licenses/LICENSE-2.0.txt'
                    }
                }
                developers {
                    developer {
                        id = 'jiangtj'
                        name = 'Jiang TJ'
                        email = '[email protected]'
                    }
                }
                scm {
                    connection = 'scm:git:git://github.com/jiangtj-lab/commonmark-spring-starter.git'
                    developerConnection = 'scm:git:ssh://github.com/jiangtj-lab/commonmark-spring-starter.git'
                    url = 'https://github.com/jiangtj-lab/commonmark-spring-starter'
                }
            }
        }
    }
}

bintray {
    user = project.property('bintray.user')
    key = project.property('bintray.key')
    publications = ['maven']
    pkg {
        repo = 'maven'
        name = 'commonmark-spring-starter'
        userOrg = 'jiangtj'
        licenses = ['Apache-2.0']
        vcsUrl = 'https://github.com/jiangtj-lab/commonmark-spring-starter'
    }
}

你可能感兴趣的:(gradle 打包 Spring boot starter项目)