apply plugin: 'maven'
apply plugin: 'war'
apply plugin: 'spring-boot'

group = 'com.restfiddle'
version = getPomVersion()

description = ""

sourceCompatibility = 1.7
targetCompatibility = 1.7

ext{
    springBootVersion = getSpringBootVersion()
    httpComponentsVersion = '4.5.1'
}

repositories {
    mavenLocal()
    mavenCentral()
    maven { url "http://oss.jfrog.org/artifactory/oss-release-local" }
    maven { url "http://jaspersoft.artifactoryonline.com/jaspersoft/jaspersoft-repo/" }
    maven { url "https://oss.sonatype.org/content/repositories/snapshots" }
    
}

dependencies {
    compile group: 'org.springframework.boot', name: 'spring-boot-starter-data-jpa', version:springBootVersion
    compile group: 'org.springframework.boot', name: 'spring-boot-starter-data-mongodb', version:springBootVersion
    compile group: 'org.springframework.boot', name: 'spring-boot-starter-actuator', version:springBootVersion
    compile group: 'org.springframework.boot', name: 'spring-boot-starter-web', version:springBootVersion
    compile group: 'javax.servlet', name: 'jstl', version:'1.2'
    compile group: 'org.springframework.boot', name: 'spring-boot-starter-security', version:springBootVersion
    compile group: 'org.springframework.boot', name: 'spring-boot-starter-remote-shell', version:springBootVersion
    compile group: 'org.springframework.boot', name: 'spring-boot-starter-aop', version:springBootVersion
    compile group: 'org.hibernate', name: 'hibernate-validator', version:'5.1.3.Final'
    compile group: 'org.mongodb', name: 'mongo-java-driver', version:'3.1.0'
    compile group: 'org.hsqldb', name: 'hsqldb', version:'2.3.2'
    compile(group: 'org.apache.httpcomponents', name: 'httpclient', version:httpComponentsVersion) {
exclude(module: 'commons-logging')
    }
    compile group: 'org.apache.httpcomponents', name: 'httpmime', version:httpComponentsVersion
    compile group: 'org.apache.commons', name: 'commons-lang3', version:'3.3.2'
    compile group: 'com.sendgrid', name: 'sendgrid-java', version:'2.1.0'
    compile group: 'com.ryantenney.metrics', name: 'metrics-spring', version:'3.0.0'
    compile(group: 'net.sf.jasperreports', name: 'jasperreports', version:'6.0.0') {
exclude(module: 'jdtcore')
exclude(module: 'jackson-annotations')
    }
    compile group: 'com.mangofactory', name: 'swagger-springmvc', version:'0.9.4'
    compile group: 'org.ajar', name: 'swagger-spring-mvc-ui', version:'0.4'
    compile group: 'com.google.oauth-client', name: 'google-oauth-client', version:'1.19.0'
    compile group: 'com.jayway.jsonpath', name: 'json-path', version:'2.0.0'
    compile group: 'io.swagger', name: 'swagger-compat-spec-parser', version:'1.0.12'
    compile group: 'org.raml', name: 'raml-parser', version:'0.8.12'
    testCompile(group: 'org.springframework.boot', name: 'spring-boot-starter-test', version:springBootVersion) {
exclude(module: 'commons-logging')
    }
    providedCompile group: 'org.springframework.boot', name: 'spring-boot-starter-tomcat', version:springBootVersion
    providedCompile group: 'org.apache.tomcat.embed', name: 'tomcat-embed-jasper', version:'8.0.20'
}

buildscript {
    dependencies {
        classpath("org.springframework.boot:spring-boot-gradle-plugin:1.2.6.RELEASE")
    }
    repositories {
        mavenCentral()
        maven { url "http://oss.jfrog.org/artifactory/oss-release-local" }
    }
}

def getPomVersion(){
    //instead of hardcoding version, getting version from pom.xml
    def file = file('pom.xml')
    def xmlSlurper = new XmlSlurper().parse(file)
    return xmlSlurper.version
}

def getSpringBootVersion(){
    def file = file('pom.xml')
    def xmlSlurper = new XmlSlurper().parse(file)
    return xmlSlurper.parent.version
}

compileJava {
    //options.fork = true
    options.incremental = true
}

distTar.enabled = false;
distZip.enabled = false;

applicationDefaultJvmArgs = [
    "-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=8000"
]