4
votes

I have java project with gradle and spring boot that I want to deploy to Heroku.

I created myApp.war locally using gradle war (I have to deploy locally because I'm using a local lib repository). The war have been created with success, but when I tried to deploy to Heroku heroku war:deploy myApp.war --app appName, I received the error:

 ! ERROR: Your buildpacks do not contain the heroku/jvm buildpack!Add heroku/jvm to your buildpack configuration or run `heroku buildpacks:clear`.
 !        Re-run with HEROKU_DEBUG=1 for more info.
 !    There was a problem deploying to appName.
 !    Make sure you have permission to deploy by running: heroku apps:info -a appName

I'm using:

  • Java 10
  • Spring boot
  • Gradle 4
  • I have already add heroku/gradle build pack trough the heroku app settings.
  • build.gradle

    plugins { id 'java' id 'idea' id 'maven' id 'war' id 'application' id 'org.springframework.boot' version '2.0.6.RELEASE' }

    mainClassName = "com.my.app.BootApplication"

    war { baseName = 'my-app' version = '1.0.0' }

    logger.lifecycle "war.archivePath = $war.archivePath"

    description = """My app description"""

    sourceCompatibility = 10 targetCompatibility = 10

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

    repositories {
    maven { url "http://repo.maven.apache.org/maven2" } maven { url uri('../my-locally-private-repository') } }

    dependencies { compile group: 'org.springframework.boot', name: 'spring-boot-starter-data-jpa', version:'2.0.4.RELEASE' compile group: 'org.springframework.boot', name: 'spring-boot-starter-web', version:'2.0.4.RELEASE' compile group: 'org.springframework.boot', name: 'spring-boot-starter-web-services', version:'2.0.4.RELEASE' compile group: 'org.springframework.boot', name: 'spring-boot-starter-security', version:'2.0.4.RELEASE' compile 'com.github.jsimone:webapp-runner:8.5.11.3' compile group: 'org.hamcrest', name: 'hamcrest-core', version:'1.3' compile group: 'com.my.app, name: 'private-dependency-1', version:'1.0.0' testCompile group: 'org.springframework.boot', name: 'spring-boot-starter-test', version:'2.0.4.RELEASE' }

  • system.properties

    java.runtime.version=10

  • Procfile

    web: java -jar build/server/webapp-runner-.jar build/libs/.war

How can I solve this problem?

1

1 Answers

12
votes

Run heroku buildpacks:clear like the error message says. The heroku/gradle buildpack is not used when you push a WAR file.