java - 为什么heroku构建由于gradle和spring boot而失败?

标签 java spring heroku gradle plugins

我正在尝试为Spring Boot和Gradle设置基本工作区。
一切在本地和travis中都可以正常运行,但是在heroku中构建失败。我认为问题不在实际代码中,而在配置中。

这是我在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

最佳答案

您需要将gradlew检入Git。

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

因为您没有执行此操作,所以Heroku使用了非常旧的Gradle版本。

关于java - 为什么heroku构建由于gradle和spring boot而失败?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45817476/

相关文章:

python - heroku 安装 python 3.6.2 而不是 python 2.7

java - 按顺序显示链接列表,并在当前位置添加星号

java - org.hibernate.MappingException:无法确定类型:java.util.List,在表:College,用于列:[org.hibernate.mapping.Column(students)]

java - 如何使电子邮件回复成为 Web 应用程序的 HttpRequestServlet?

spring - 如何使用传播 REQUIRES_NEW 等待事务提交

java - 级联 ="all-delete- orphan"不再被引用

ruby-on-rails - 警告 : RVM used Gemfile selecting Ruby"

java - 多线程环境下ResultSet成员变量的复用

java - 如何在另一个实体中加载实体?

javascript - 在 RAILS 3.1 中的 js Assets 上设置 Cache-Control header