justcheckers/build.gradle

134 lines
3.8 KiB
Groovy
Executable File

/*
* Modular Gradle Build for justCheckers
* Author: Dorian Pula
*
* URI for docs: http://www.gradle.org/docs/current/userguide/userguide_single.html
*/
// TODO: Add the Android Gradle plugin: https://github.com/jvoegele/gradle-android-plugin/wiki
// TODO: Add in support for multiple projects, to allow for clean separation of projects.
apply plugin: 'war'
apply plugin: 'jetty'
sourceCompatibility = 1.6
targetCompatibility = 1.6
// Description of the project
description = 'justCheckers'
version = '0.3'
project.ext {
appName = 'justCheckers'
appBaseName = "justcheckers"
hibernateVersion = '3.5.4-Final'
slf4jVersion = '1.6.0'
springVersion = '3.1.3.RELEASE'
}
// Setup everything to work with the Eclipse friendly Web setup.
sourceSets.main.java.srcDirs = ['src', 'gen']
sourceSets.main.resources.srcDirs = ['res']
//sourceSets.test.java.srcDirs = ['test-src']
// Setup build script repositories starting with Maven repositories
repositories {
flatDir {
dirs 'WebContent/WEB-INF/lib'
}
maven {
url 'http://repo1.maven.org/maven2'
}
}
// Dependency management
dependencies {
// Spring Framework + SLF4J
compile ('org.springframework:spring-context:' + project.springVersion) {
exclude module: 'commons-logging'
}
compile 'log4j:log4j:1.2.16'
compile 'org.slf4j:jcl-over-slf4j:' + project.slf4jVersion
compile 'org.slf4j:slf4j-api:' + project.slf4jVersion
compile 'org.slf4j:slf4j-log4j12:' + project.slf4jVersion
compile 'org.springframework:spring-jdbc:' + project.springVersion
compile 'org.springframework:spring-orm:' + project.springVersion
compile 'org.springframework:spring-webmvc:' + project.springVersion
compile 'org.springframework:spring-parent:' + project.springVersion
compile 'mysql:mysql-connector-java:5.1.22'
// xstream
compile 'com.thoughtworks.xstream:xstream:1.4.4'
// Hibernate + C3P0
compile 'org.hibernate:hibernate:' + project.hibernateVersion
compile 'org.hibernate:hibernate-annotations:' + project.hibernateVersion
compile 'org.hibernate:hibernate-c3p0:' + project.hibernateVersion
compile 'javassist:javassist:3.9.0.GA'
// Apache Commons Libraries
compile 'commons-httpclient:commons-httpclient:3.1'
compile 'commons-lang:commons-lang:2.4'
// FlexJson
compile 'net.sf.flexjson:flexjson:2.1'
// Javax Servlet and Mail APIs
providedCompile 'javax.servlet:servlet-api:2.5'
}
// At the end of day we just need a JAR and a WAR.
ext.sharedManifest = manifest {
attributes(
'App-Name' : project.appName,
'App-Version' : version,
'Build-User' : System.properties['user.name'],
'Build-Time' : new Date().format('yyyy-MMMM-dd HH:mm:ss'),
'Build-OS' : System.properties['os.name'] + ' - version ' + System.properties['os.version'],
'Build-Sys' : System.properties['os.arch'],
'Java-Version' : System.properties['java.version'],
'Java-Vendor' : System.properties['java.vendor'],
'Java-VM' :
System.properties['java.vm.vendor'] + ' ' + System.properties['java.vm.name'] + ' v'
+ System.properties['java.vm.version'])
}
// Build the JAR.
jar {
enabled = true
includeEmptyDirs = false
manifest = sharedManifest
include '**/**.class'
exclude 'build/**'
}
// Build WAR files that include the JAR file. Add the resources back in.
war {
from 'webapp'
exclude 'WEB-INF/lib'
classpath = project.configurations.runtime - project.configurations.providedRuntime + jar.outputs.files
manifest = sharedManifest
includeEmptyDirs = false
into('WEB-INF/classes') {
from sourceSets.main.resources
}
}
jettyRun {
httpPort = 8080
contextPath = project.appBaseName
webAppSourceDirectory = new File('webapp')
}
// Run embedded Jetty setup.
jettyRunWar {
httpPort = 8080
contextPath = project.appBaseName
}