将Gradle项目部署到Heroku时出错

问题描述 投票:0回答:0

我正在尝试在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文档中,但我仍然找不到能够解决我的问题的解决方案。

spring spring-boot heroku gradle build.gradle
© www.soinside.com 2019 - 2024. All rights reserved.