使用瘦客户端构建时,Spring Boot 2.0.X launchscript()无法正常工作

时间:2019-01-25 06:09:52

标签: spring-boot gradle

下面是我使用的gradle文件。

没有稀疏的依赖关系,launchscript()可以正常工作。 创建的精简jar中没有任何依赖关系,并且正在运行。问题是午餐脚本未随罐一起添加,并且无法作为服务运行罐

尝试使用gradle版本4.5.1

buildscript {
    ext {
        springBootVersion = '2.0.1.RELEASE'
        wrapperVersion = '1.0.21.RELEASE'
    }
    repositories {
        mavenCentral()
    }
    dependencies {
        classpath("org.springframework.boot.experimental:spring-boot-thin-gradle-plugin:${wrapperVersion}")
        classpath("org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}")
    }
}

apply plugin: 'java'
apply plugin: 'eclipse'
apply plugin: 'org.springframework.boot'
apply plugin: 'io.spring.dependency-management'
apply plugin: 'maven'
apply plugin: 'org.springframework.boot.experimental.thin-launcher'

group = 'com.example'
version = '0.0.1-SNAPSHOT'
sourceCompatibility = 1.8

task createPom {
    def basePath = 'build/resources/main/META-INF/maven'
    doLast {
        pom {
            withXml(dependencyManagement.pomConfigurer)
        }.writeTo("${basePath}/${project.group}/${project.name}/pom.xml")
    }
}

bootJar.dependsOn = [createPom]
bootJar.dependsOn = [thinProperties]

bootJar {
    launchScript()
}

repositories {
    mavenCentral()
}


dependencies {
    compile('org.springframework.boot:spring-boot-starter-web')
    compile group: 'org.springframework.boot', name: 'spring-boot-starter-actuator', version: '2.0.6.RELEASE'
    testCompile('org.springframework.boot:spring-boot-starter-test')
}

dependencyManagement {
    imports {
        mavenBom "org.springframework.cloud:spring-cloud-dependencies:Dalston.SR1"
    }
}

0 个答案:

没有答案