2

I am trying to deploy spring boot gradle project to heroku. The app is running fine locally. But after executing git push heroku master the push crashes with the error error: package org.json does not exist Here is my Procfile

web: java -Xmx384m -Xss512k -XX:+UseCompressedOops -jar target/*.jar 
--server.port=$PORT 
--spring.data.mongodb.uri=$MONGOLAB_URI

and here is my build.gradle

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



buildscript {
    ext {
        springBootVersion = '1.4.0.RELEASE'
    }
    repositories {
        mavenCentral()
        maven {
            url "https://plugins.gradle.org/m2/"
        }
    }
    dependencies {
        classpath("org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}")
    }
}



jar {
    baseName = 'planaroute'
    version = '0.0.1-SNAPSHOT'
}
sourceCompatibility = 1.8
targetCompatibility = 1.8

repositories {
    mavenCentral()
}


dependencies {
    compile("org.springframework.boot:spring-boot-starter-web")
    compile('org.springframework.boot:spring-boot-starter')
    compile("org.springframework.boot:spring-boot-starter-data-mongodb")
    compile 'org.springframework.data:spring-data-mongodb:1.9.2.RELEASE'
    compile group: 'org.json', name: 'json', version: '20160810'
    compile group: 'org.json', name: 'org.json', version: 'chargebee-1.0'
    testCompile('org.springframework.boot:spring-boot-starter-test')
}


eclipse {
    classpath {
         containers.remove('org.eclipse.jdt.launching.JRE_CONTAINER')
         containers 'org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8'
    }
}

Even I have downloaded org.json jar and added the jar externally to the project. It still doesnot work.

Debanjan
  • 2,817
  • 2
  • 24
  • 43

1 Answers1

0

I added the following dependency to my build.gradle file and it worked fine after.

dependencies { compile 'org.json:json:20090211' . . all my other project dependecies . }

I hope it helps you as it helped me.

Credits to Dependencies not copied into jar (in Gradle) where I got this hint from.

Best wishes, Marcos.