Deploying a gradle app for Heroku

I am learning how to use Heroku and I am trying to deploy my gradle app. I don't know how to solve the problem.

Here is my config.

system.properties

java.runtime.version=1.7

      

build.gradle

...
task wrapper(type: Wrapper) {
    gradleVersion = '1.6'
}

task stage(type: Copy, dependsOn: [clean, build]) {
    from jar.archivePath
    into project.rootDir 
    rename {
        'app.jar'
    }
}
stage.mustRunAfter(clean)

clean << {
    project.file('app.jar').delete()
}

      

PROCFILE

web: java -Dserver.port=$PORT -jar app.jar

      

Error message

remote: -----> Gradle app detected
remote: -----> Installing OpenJDK 1.7... done
remote: -----> Building Gradle app...
remote:        WARNING: The Gradle buildpack is currently in Beta.
remote: -----> executing ./gradlew stage
remote:        Error: Could not find or load main class     org.gradle.wrapper.GradleWrapperMain
remote:  !     Failed to build app
remote: 
remote:  !     Push rejected, failed to compile Gradle app

      

I have a wrapper in git. I have no idea why this is not working. Thanks for your help.

+3


source to share


1 answer


Woohoo, unrolled it! Final gradle:

group 'com.zzheads'
version '1.0-SNAPSHOT'

buildscript {
    repositories {
        mavenCentral()
    }
    dependencies {
        classpath  'org.springframework.boot:spring-boot-gradle-plugin:1.3.6.RELEASE'
    }
}

apply plugin: 'java'
apply plugin: 'spring-boot'

sourceCompatibility = 1.8

repositories {
    mavenCentral()
}

dependencies {
    compile("org.springframework.boot:spring-boot-starter-thymeleaf")
}

task stage {
    dependsOn build
}

      

Procfile:

web: java -Dserver.port=$PORT $JAVA_OPTS -jar build/libs/countries-1.0-SNAPSHOT.jar

      



Couldn't check it locally, throw error

E:\Projects\countries>heroku local -f Procfile.win
[WARN] No ENV file found
17:06:26 web.1   |  "build" ?? ?????? ???????? ??? ?????
17:06:26 web.1   |  ????????, ??????? ?????? ??? ???????? ????.
[DONE] Killing all processes with signal  null
17:06:26 web.1   Exited with exit code 1

      

Last thing TODO: App doesn't see my / static folder correctly, so all .css files not found: /

0


source







All Articles