Permalink
Find file
Fetching contributors…
Cannot retrieve contributors at this time
267 lines (222 sloc) 8 KB
/*
* Copyright 2012 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
group = "com.trenako"
description = "A social network for model railways."
def springVersion = "3.2.3.RELEASE"
def springDataVersion = "1.5.1.RELEASE"
def springDataMongoVersion = "1.2.1.RELEASE"
def securityVersion = "3.1.4.RELEASE"
def slf4jVersion = "1.7.5"
def log4jVersion = "1.2.17"
def logbackVersion = "1.0.13"
def spockVersion = "0.7-groovy-2.0"
def mongoDriverVersion = "2.9.0"
def hamcrestVersion = "1.3"
def hibernateValidationVersion = "4.3.1.Final"
def aspectjVersion = "1.7.0.RELEASE"
allprojects {
apply plugin: 'java'
apply plugin: 'groovy'
apply plugin: 'eclipse-wtp'
apply plugin: 'idea'
sourceCompatibility = JavaVersion.VERSION_1_7
targetCompatibility = JavaVersion.VERSION_1_7
test {
testLogging {
exceptionFormat = 'full'
events 'skipped', 'failed'
}
}
repositories {
mavenCentral()
maven {url "http://repo.springsource.org/release"}
maven {url "http://repository.jboss.org/nexus/content/repositories/releases/"}
}
configurations {
integrationTestCompile {
extendsFrom testCompile
}
integrationTestRuntime {
extendsFrom integrationTestCompile, testRuntime
}
}
sourceSets {
integrationTest {
groovy.srcDir file('src/integrationTest/groovy')
resources.srcDir file('src/integrationTest/resources')
compileClasspath = sourceSets.main.output + sourceSets.test.output + configurations.integrationTestCompile
runtimeClasspath = output + compileClasspath + configurations.integrationTestRuntime
}
}
eclipse {
// add the integration classpath
classpath {
plusConfigurations += configurations.integrationTestRuntime
//default settings for dependencies sources/javadoc download:
downloadSources = true
downloadJavadoc = true
}
}
dependencies {
// logging
compile "org.slf4j:slf4j-api:${slf4jVersion}"
runtime "org.slf4j:jcl-over-slf4j:${slf4jVersion}",
"log4j:log4j:${log4jVersion}",
"ch.qos.logback:logback-classic:${logbackVersion}",
"ch.qos.logback:logback-core:${logbackVersion}"
// spring framework
compile("org.springframework:spring-context:${springVersion}") {
exclude group: "commons-logging", module: "commons-logging"
}
// aop - aspectj
compile("org.springframework:spring-aop:${springVersion}") {
exclude group: "commons-logging", module: "commons-logging"
}
compile "org.aspectj:aspectjrt:${aspectjVersion}",
"org.aspectj:aspectjweaver:${aspectjVersion}"
// GCLIB, required for @Configuration usage
compile "cglib:cglib-nodep:2.2.2"
// apache commons
compile "org.apache.commons:commons-lang3:3.1"
compile "commons-beanutils:commons-beanutils-core:1.8.3"
// joda time
compile "joda-time:joda-time:2.2"
// spring data mongodb
compile "org.springframework.data:spring-data-commons:${springDataVersion}"
compile "org.springframework.data:spring-data-mongodb:${springDataMongoVersion}"
compile "org.mongodb:mongo-java-driver:${mongoDriverVersion}"
// unit testing
testCompile "junit:junit:4.11",
"org.mockito:mockito-core:1.9.5",
"org.springframework:spring-test:${springVersion}",
"org.hamcrest:hamcrest-core:${hamcrestVersion}",
"org.hamcrest:hamcrest-library:${hamcrestVersion}"
// spock testing
testCompile "org.codehaus.groovy:groovy:2.0.8"
testCompile "org.spockframework:spock-core:${spockVersion}",
"org.spockframework:spock-spring:${spockVersion}"
}
task integrationTest(description: 'Runs the integration tests.', group: 'Verification', type: Test) {
testClassesDir = sourceSets.integrationTest.output.classesDir
classpath = sourceSets.integrationTest.runtimeClasspath
}
check.dependsOn integrationTest
}
subprojects { subproj ->
jar {
manifest {
attributes("Implementation-Title": subproj.name, "Implementation-Version": version)
}
}
}
project("trenako-common") {
description = 'The domain entity classes.'
dependencies {
// JSR 303 with Hibernate Validator
compile "javax.validation:validation-api:1.0.0.GA"
compile "org.hibernate:hibernate-validator:${hibernateValidationVersion}",
"org.hibernate:hibernate-validator-annotation-processor:${hibernateValidationVersion}"
}
task testJar(description: 'Assembles a jar archive containing the test classes.', group: 'Build', type: Jar) {
classifier = 'tests'
from sourceSets.test.output.classesDir
}
}
project("trenako-services") {
description = 'The domain entity classes.'
dependencies {
compile project(":trenako-common")
testCompile project(":trenako-test")
// spring security
compile("org.springframework.security:spring-security-core:${securityVersion}") {
exclude group: "commons-logging", module: "commons-logging"
}
compile("org.springframework.security:spring-security-config:${securityVersion}") {
exclude group: "commons-logging", module: "commons-logging"
}
integrationTestCompile "com.gmongo:gmongo:1.2"
}
}
project("trenako-web") {
apply plugin: 'war'
apply plugin: 'jetty'
description = 'The web application.'
// jetty
[jettyRun, jettyRunWar]*.httpPort = 9090
[jettyRun, jettyRunWar]*.contextPath = 'trenako'
[jettyRun, jettyRunWar]*.stopKey = 'rocket'
jettyStop {
stopPort = 9090
stopKey = 'rocket'
}
dependencies {
compile project(":trenako-common")
compile project(":trenako-services")
testCompile project(":trenako-test")
// spring mvc
compile "org.springframework:spring-web:${springVersion}"
compile "org.springframework:spring-webmvc:${springVersion}"
compile "org.springframework.hateoas:spring-hateoas:0.5.0.RELEASE"
compile("org.springframework.security:spring-security-web:${securityVersion}") {
exclude group: "commons-logging", module: "commons-logging"
}
compile("org.springframework.security:spring-security-config:${securityVersion}") {
exclude group: "commons-logging", module: "commons-logging"
}
compile "org.springframework.security:spring-security-taglibs:${securityVersion}"
// Sitemesh
compile "opensymphony:sitemesh:2.4.2"
// thumbnailator
compile "net.coobird:thumbnailator:0.4.3"
// files upload
compile "commons-fileupload:commons-fileupload:1.3",
"commons-io:commons-io:2.4"
// Gravatar4java
compile "de.bripkens:gravatar4java:1.1"
// Servlet Api
providedCompile "javax.servlet:javax.servlet-api:3.0.1"
compile "javax.servlet:jstl:1.2",
"javax.servlet.jsp:javax.servlet.jsp-api:2.2.1"
// PowerMock (for static class tests)
testCompile "org.powermock:powermock-module-junit4:1.4.12",
"org.powermock:powermock-api-mockito:1.4.12"
}
}
// javadoc
task projectDoc(type: Javadoc, group: 'Documentation', description: 'Generates aggregated Javadoc API documentation.') {
options.memberLevel = org.gradle.external.javadoc.JavadocMemberLevel.PROTECTED
options.author = true
options.header = rootProject.description
source subprojects.collect { subproj ->
subproj.sourceSets.main.allJava
}
destinationDir = new File(buildDir, "docs")
classpath = files(subprojects.collect { project ->
project.sourceSets.main.compileClasspath
})
}
// wrapper task to create the download script
task wrapper(type: Wrapper, group: 'Gradle wrapper',
description: 'Gradle will be automatically downloaded and used to run the build.') {
gradleVersion = '1.6'
}
task testReport(type: TestReport, group: 'Verification',
description: 'Merge the results from both `test` and `integrationTest` task in all subprojects.') {
destinationDir = file("$buildDir/reports/allTests")
reportOn subprojects*.test
reportOn subprojects*.integrationTest
}
check.dependsOn testReport