Skip to content

Instantly share code, notes, and snippets.

@balteo
Created November 6, 2014 17:33
Show Gist options
  • Save balteo/ad60db682ae8e87f2c69 to your computer and use it in GitHub Desktop.
Save balteo/ad60db682ae8e87f2c69 to your computer and use it in GitHub Desktop.
import org.gradle.api.tasks.Exec
import com.bignibou.build.Grunt
buildscript {
ext.springBootVersion = "1.2.0.BUILD-SNAPSHOT"
repositories {
mavenCentral()
maven { url "http://repo.spring.io/release" }
maven { url "http://repo.spring.io/milestone" }
maven { url "http://repo.spring.io/snapshot" }
}
dependencies {
classpath ("org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}")
}
}
configure(allprojects) { project ->
group = "com.bignibou"
version = "1.0.0"
ext.springSecurityVersion = "4.0.0.M2"
ext.springBootVersion = "1.2.0.BUILD-SNAPSHOT"
ext.springSessionVersion = "1.0.0.BUILD-SNAPSHOT"
ext.springSessionDataRedisVersion = "1.0.0.BUILD-SNAPSHOT"
ext.hibernateVersion = "4.3.6.Final"
ext.javaxMailVersion = "1.4.7"
ext.queryDslVersion = "3.5.0"
ext.thymeleafTilesVersion = "2.1.1.RELEASE"
ext.apacheCommonsLang = "3.1"
ext.javaxValidationApi = "1.1.0.Final"
ext.javaxActivation = "1.1.1"
ext.commonsCodec = "1.9"
ext.jstl = "1.2"
ext.hibernateJpa = "1.0.0.Final"
ext.cglibNodep = "3.1"
ext.commonsIo = "2.4"
ext.javaxTransactionJta = "1.1"
ext.jacksonHibernate4 = "2.4.3"
ext.junitVersion = "4.11"
ext.mockitoVersion = "1.10.8"
ext.hamcrestVersion = "1.3"
ext.festVersion = "1.4"
ext.wiserVersion = "3.1.7"
ext.h2Version = "1.4.182"
ext.gatlingVersion = "2.0.1"
apply plugin: 'java'
apply plugin: 'eclipse'
repositories {
mavenLocal()
mavenCentral()
maven { url "http://repo.spring.io/release" }
maven { url "http://repo.spring.io/milestone" }
maven { url "http://repo.spring.io/snapshot" }
}
compileJava {
sourceCompatibility = 1.8
targetCompatibility = 1.8
}
test {
reports.html.destination = file("$reports.html.destination/unit")
reports.junitXml.destination = file("$reports.junitXml.destination/unit")
}
configurations.all {
resolutionStrategy.eachDependency { DependencyResolveDetails details ->
if (details.requested.group.startsWith("org.apache.tomcat")) {
details.useVersion "8.0.14"
}
if (details.requested.group == "org.springframework" && details.requested.name != "spring-test-htmlunit") {
details.useVersion "4.1.2.BUILD-SNAPSHOT"
}
if (details.requested.group == "org.springframework.security") {
details.useVersion "4.0.0.M2"
}
}
}
}
project("bignibou-server") {
description = "Bignibou Server"
configurations { querydslapt }
apply plugin: 'groovy'
apply plugin: 'spring-boot'
dependencies {
compile project(":bignibou-client")
//Spring bootbignibou-server
compile("org.springframework.boot:spring-boot-starter-actuator")
compile("org.springframework.boot:spring-boot-starter-data-jpa")
compile("org.springframework.boot:spring-boot-starter-redis")
compile("org.springframework.boot:spring-boot-starter-web")
compile("org.springframework.boot:spring-boot-starter-security")
compile("org.springframework.boot:spring-boot-starter-thymeleaf")
// Miscellaneous //TODO Clean up later on!
compile("org.apache.commons:commons-lang3:${apacheCommonsLang}")
compile("javax.mail:mail:${javaxMailVersion}")
compile("javax.activation:activation:${javaxActivation}")
compile("joda-time:joda-time")
compile("log4j:log4j")
compile("commons-codec:commons-codec:${commonsCodec}")
compile("commons-collections:commons-collections")
compile("commons-io:commons-io:${commonsIo}")//TODO Remove later on?
// Thymeleaf
compile("org.thymeleaf.extras:thymeleaf-extras-tiles2:${thymeleafTilesVersion}")
compile("org.thymeleaf.extras:thymeleaf-extras-tiles2-spring4:${thymeleafTilesVersion}")
compile("org.thymeleaf.extras:thymeleaf-extras-springsecurity3")
compile("javax.servlet:jstl:${jstl}")
//Caching
compile 'org.hibernate:hibernate-ehcache:4.3.6.Final'
// Relational Database
compile("mysql:mysql-connector-java")
compile("org.flywaydb:flyway-core")
// Connection pooling
compile("com.zaxxer:HikariCP")
compile("commons-pool:commons-pool")
// QueryDSL
compile("com.mysema.querydsl:querydsl-core:${queryDslVersion}")
compile("com.mysema.querydsl:querydsl-jpa:${queryDslVersion}")
querydslapt("com.mysema.querydsl:querydsl-apt:${queryDslVersion}")
// Jackson
compile("com.fasterxml.jackson.core:jackson-core")
compile("com.fasterxml.jackson.core:jackson-annotations")
compile("com.fasterxml.jackson.datatype:jackson-datatype-hibernate4:${jacksonHibernate4}")//TODO Needed?
// Spring Session
compile("org.springframework.session:spring-session:${springSessionVersion}")
compile("org.springframework.session:spring-session-data-redis:${springSessionDataRedisVersion}")
// Spring Cloud
compile("org.springframework.cloud:spring-cloud-spring-service-connector")
compile("org.springframework.cloud:spring-cloud-heroku-connector")
compile("org.springframework.cloud:spring-cloud-localconfig-connector")
// Testing
testCompile("org.springframework.boot:spring-boot-starter-test")
testCompile("org.springframework.security:spring-security-test:${springSecurityVersion}")
testCompile("org.mockito:mockito-core:${mockitoVersion}")
testCompile("org.hamcrest:hamcrest-core:${hamcrestVersion}")
testCompile("org.easytesting:fest-assert:${festVersion}")
testCompile("com.h2database:h2:${h2Version}")
testCompile("org.subethamail:subethasmtp:${wiserVersion}")
// testCompile("io.gatling.highcharts:gatling-charts-highcharts:${gatlingVersion}")
testCompile 'org.springframework:spring-test-htmlunit:1.0.0.BUILD-SNAPSHOT'
testCompile "org.seleniumhq.selenium:selenium-htmlunit-driver:2.42.2"
testCompile "org.gebish:geb-spock:0.10.0"
testCompile ('org.spockframework:spock-spring:0.7-groovy-2.0') {
exclude group: 'org.codehaus.groovy'
}
testCompile 'org.codehaus.groovy:groovy-all:2.3.7'
}
springBoot { mainClassName = "com.bignibou.Application" }
// TODO will this be a problem in the cloud?
run {
//systemProperty "spring.profiles.active", "$System.env.SPRING_PROFILES_ACTIVE" // "dev" // "test"
systemProperty "spring.cloud.propertiesFile", "$System.env.SPRING_CLOUD_PROPERTIESFILE" // "../spring-cloud.properties"
}
sourceSets {
generated {
java { srcDirs = [ 'build/generated-sources/java'
] } }
main { java { srcDir 'build/generated-sources/java' } }
integrationTest {
java.srcDirs = ['src/it/java']
resources.srcDir file('src/it/resources')
compileClasspath = sourceSets.main.output + configurations.testRuntime
runtimeClasspath = output + compileClasspath
}
end2endTest {
java.srcDirs = []
groovy.srcDirs = ['src/end2end/groovy']
compileClasspath = sourceSets.main.output + configurations.testRuntime + sourceSets.integrationTest.output.classesDir
runtimeClasspath = output + compileClasspath
}
}
task generateQueryDSL(type: JavaCompile, group: 'build') {
description "Generates the QueryDSL query types"
source = sourceSets.main.java
classpath = configurations.compile + configurations.querydslapt
options.compilerArgs = [
"-proc:only",
"-processor",
"com.mysema.query.apt.jpa.JPAAnnotationProcessor"
]
destinationDir = sourceSets.generated.java.srcDirs.iterator().next()
}
task integrationTest(type: Test) {
description "Run the integration tests."
testClassesDir = sourceSets.integrationTest.output.classesDir
classpath = sourceSets.integrationTest.runtimeClasspath
reports.html.destination = file("$reports.html.destination/integration")
reports.junitXml.destination = file("$reports.junitXml.destination/integration")
}
task end2endTest(type: Test) {
description "Run the end2end tests."
testClassesDir = sourceSets.end2endTest.output.classesDir
classpath = sourceSets.end2endTest.runtimeClasspath + sourceSets.integrationTest.compileClasspath
reports.html.destination = file("$reports.html.destination/end2end")
reports.junitXml.destination = file("$reports.junitXml.destination/end2end")
}
compileJava {
dependsOn generateQueryDSL
source generateQueryDSL.destinationDir
}
compileGeneratedJava {
dependsOn generateQueryDSL
options.warnings = false
classpath += sourceSets.main.runtimeClasspath
}
compileGroovy {
sourceCompatibility = 1.8
targetCompatibility = 1.8
}
end2endTest {
doFirst {
systemProperties['geb.build.reportsDir'] = 'build/geb-reports'
systemProperties['geb.build.baseUrl'] = 'http://localhost:8080/'
}
}
check.dependsOn integrationTest
integrationTest.shouldRunAfter test
end2endTest.shouldRunAfter integrationTest
clean {
delete sourceSets.generated.java.srcDirs
}
}
project("bignibou-client") {
description = "Bignibou Client"
task installGruntDependencies(type: Exec){
description "Installs grunt dependencies"
inputs.file "package.json"
outputs.dir "node_modules"
executable "npm"
args "install"
}
task grunt(type: Grunt, dependsOn: installGruntDependencies) {
description "Runs grunt on Gruntfile.js"
commands = ['default']
}
}
task wrapper(type: Wrapper) { gradleVersion = '2.1' }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment