gradle打包springboot項目報錯 no main manifest attribute, in ./build/libs/scaffold-1.0-SNAPSHOT.jar

產生錯誤緣由是由於build.gradle文件缺乏了gradle的打包插件java

buildscript {
    dependencies {
        classpath("org.springframework.boot:spring-boot-gradle-plugin:2.2.6.RELEASE")
    }
}

plugins {
    id 'java'
}


apply plugin: 'java'
apply plugin: 'org.springframework.boot'

group 'com.guanguan.docker'
version '1.0-SNAPSHOT'

sourceCompatibility = 1.8

repositories {
    mavenCentral()
}

dependencies {
    compile('org.springframework.boot:spring-boot-starter-web:2.2.6.RELEASE')
    testCompile group: 'junit', name: 'junit', version: '4.12'
}

補上spring-boot-gradle-plugin便可。web

 

驗證:spring

./gradlew builddocker

$ java -jar ./build/libs/scaffold-1.0-SNAPSHOT.jarapp

而後就能看到程序起起來了。maven

相關文章
相關標籤/搜索