美文网首页
gradle 打包 Spring boot starter项目

gradle 打包 Spring boot starter项目

作者: MrTT | 来源:发表于2020-07-23 21:47 被阅读0次

    打包上传到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 = 'i@dnocm.com'
                        }
                    }
                    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项目

          本文链接:https://www.haomeiwen.com/subject/sedklktx.html