2017-08-22 143 views
-1

我想設置Spring引導和gradle的基本工作區。 一切在當地和特拉維斯完美的作品,但在英雄構建失敗。我認爲問題不在實際的代碼中,而是在配置中。爲什麼Herku構建失敗與gra和春季啓動?

這是我在github.

build.gradle 

plugins { 
    id 'java' 
    id 'maven' 
    id 'jacoco' 
    id 'org.springframework.boot' version '1.5.3.RELEASE' 
} 

group = 'org.karlin' 
version = '0.1.0' 

sourceCompatibility = 1.8 
targetCompatibility = 1.8 

tasks.withType(JavaCompile) { 
    options.encoding = 'UTF-8' 
} 

bootRepackage { 
    mainClass = 'gramise.Gramise' 
} 

repositories { 
    maven { 
     url("https://plugins.gradle.org/m2/") 
    } 
} 

dependencies { 
    compile("com.google.code.gson:gson") 
    compile("org.springframework.boot:spring-boot-starter-thymeleaf") 
    compile("org.springframework.boot:spring-boot-starter-data-jpa") 
    compile("org.postgresql:postgresql") 
    compile("org.apache.commons:commons-dbcp2") 
    compile("com.h2database:h2") 
    testCompile(group: 'org.springframework.boot', name: 'spring-boot- 
    starter-test', version:'1.5.3.RELEASE') { 
     exclude(module: 'commons-logging') 
    } 
    testCompile group: 'com.jayway.jsonpath', name: 'json-path', version:'2.2.0' 
} 

task stage(dependsOn: ['build', 'clean']) 
build.mustRunAfter clean 

項目還有就是Heroku的構建日誌

-----> Gradle app detected 
-----> Installing OpenJDK 1.8... done 
-----> Installing Gradle Wrapper... 
     WARNING: Your application does not have it's own gradlew file. 
-----> Building Gradle app... 
-----> executing ./gradlew build 
     Download https://plugins.gradle.org/m2/org/springframework/boot/spring-boot-gradle-plugin/1.5.3.RELEASE/spring-boot-gradle-plugin-1.5.3.RELEASE.pom 
     Download https://plugins.gradle.org/m2/org/springframework/boot/spring-boot-tools/1.5.3.RELEASE/spring-boot-tools-1.5.3.RELEASE.pom 
     Download https://plugins.gradle.org/m2/org/springframework/boot/spring-boot-loader-tools/1.5.3.RELEASE/spring-boot-loader-tools-1.5.3.RELEASE.pom 
     Download https://plugins.gradle.org/m2/io/spring/gradle/dependency-management-plugin/1.0.2.RELEASE/dependency-management-plugin-1.0.2.RELEASE.pom 
     Download https://plugins.gradle.org/m2/org/springframework/spring-core/4.3.8.RELEASE/spring-core-4.3.8.RELEASE.pom 
     Download https://plugins.gradle.org/m2/org/springframework/boot/spring-boot-gradle-plugin/1.5.3.RELEASE/spring-boot-gradle-plugin-1.5.3.RELEASE.jar 
     Download https://plugins.gradle.org/m2/org/springframework/boot/spring-boot-loader-tools/1.5.3.RELEASE/spring-boot-loader-tools-1.5.3.RELEASE.jar 
     Download https://plugins.gradle.org/m2/io/spring/gradle/dependency-management-plugin/1.0.2.RELEASE/dependency-management-plugin-1.0.2.RELEASE.jar 
     Download https://plugins.gradle.org/m2/org/springframework/spring-core/4.3.8.RELEASE/spring-core-4.3.8.RELEASE.jar 

     FAILURE: Build failed with an exception. 

     * What went wrong: 
     org/gradle/api/plugins/JavaPlugin 
     > org.gradle.api.plugins.JavaPlugin 

     * Try: 
     Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. 

     BUILD FAILED 
+0

「使用--stacktrace選項運行以獲取堆棧跟蹤。使用--info或--debug選項運行以獲取更多日誌輸出。」 - 你做了這個了嗎? – duffymo

+0

是的,有完整的日誌與--stacktrace選項 https://gist.github.com/rovaniemi/86300470cf11abb30ff92f0fe84f31d1 –

+0

我不看它。你應該。 – duffymo

回答

0

你需要檢查gradlew到Git的。

WARNING: Your application does not have it's own gradlew file. 

因爲你沒有這樣做,Heroku使用了一個非常老的Gradle版本。

+0

好的,我也會這樣做。謝謝。 –

0

如果別人遇到這個問題,這個固定

我的build.gradle添加buildscript

buildscript { 
    ext { 
     springBootVersion = '1.5.3.RELEASE' 
    } 
    repositories { 
     mavenCentral() 
     maven { url 'https://repo.spring.io/libs-snapshot' } 
    } 
    dependencies { 
     classpath "org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}" 
    } 
} 

現在一切工作,感謝您的幫助。