将Gradle项目部署到Heroku时出错

时间:2018-02-22 15:01:34

标签: spring spring-boot heroku gradle build.gradle

我试图在Heroku中构建Spring Boot应用程序,但显然,他们无法找到JAR文件

2018-02-22T14:54:06.434832+00:00 heroku[web.1]: Process exited with status 1
2018-02-22T14:54:06.350652+00:00 app[web.1]: Setting JAVA_TOOL_OPTIONS defaults based on dyno size. Custom settings will override them.
2018-02-22T14:54:06.359456+00:00 app[web.1]: Error: Unable to access jarfile build/libs/algamoney*.jar
2018-02-22T14:54:06.667596+00:00 heroku[web.1]: State changed from starting to crashed

我创建了个人资料:

web: java -Dserver.port=$PORT -Dspring.profiles.active=prod $JAVA_OPTS -jar build/libs/algamoney*.jar

我在堆栈溢出中发现了一些类似的问题,解决方案是将一些任务放在build.gradle文件中,但它仍然无法正常工作。这是我的build.gradle文件:

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

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

group = 'com.algaworks.algamoney-api'
version = '0.0.1-SNAPSHOT'
sourceCompatibility = 1.8

repositories {
    mavenCentral()
}


dependencies {
    compile('org.springframework.boot:spring-boot-starter-data-jpa')
    compile('org.springframework.boot:spring-boot-starter-web')
    compile('org.springframework.boot:spring-boot-starter-security')
    compile "org.springframework.boot:spring-boot-configuration-processor"
    compile('org.springframework.security.oauth:spring-security-oauth2')
    compile('org.springframework.security:spring-security-jwt')
    compile('mysql:mysql-connector-java')
    compile('org.flywaydb:flyway-core')
    compile('org.hibernate:hibernate-java8')    
    compile('com.fasterxml.jackson.datatype:jackson-datatype-jsr310')  
    compile group: 'org.apache.commons', name: 'commons-lang3', version: '3.4'

    runtime('org.springframework.boot:spring-boot-devtools')
    testCompile('org.springframework.boot:spring-boot-starter-test')
}

我已经找了很多可能的解决方案,即使是在heroku文档中,但我仍然没有找到任何可以解决我问题的解决方案。

0 个答案:

没有答案
相关问题