Skip to content

Instantly share code, notes, and snippets.

@eduardoschmidtsantos
Created July 31, 2014 01:17
Show Gist options
  • Save eduardoschmidtsantos/7ef5e29d41e647348b77 to your computer and use it in GitHub Desktop.
Save eduardoschmidtsantos/7ef5e29d41e647348b77 to your computer and use it in GitHub Desktop.
apply plugin: 'war'
apply plugin: 'java'
compileJava.options.encoding = 'iso-8859-1'
compileJava.options.compilerArgs << '-Xlint:unchecked'
compileJava.options.compilerArgs << '-Xlint:deprecation'
compileJava.options.fork = true
compileJava.options.forkOptions.setMemoryMaximumSize("4g")
targetCompatibility = 1.6
sourceCompatibility = 1.6
dependencies {
providedCompile fileTree(dir: 'lib/test', include: '*.jar')
providedCompile fileTree(dir: 'lib/build', include: '*.jar')
providedCompile fileTree(dir: 'lib/provided', include: '*.jar')
compile fileTree(dir: 'lib/runtime', include: '*.jar')
}
[
['oracle', 'java:/ChannelDS', 'br.com.jexperts.channel2.resources.CustomOracle10gDialect'],
['sqlserver', 'java:/SqlServerDS', 'org.hibernate.dialect.SQLServerDialect'],
['postgres', 'java:/PostgresDS', 'org.hibernate.dialect.PostgreSQLDialect'],
].each { db ->
task "${db[0]}Hbm"(dependsOn: processResources) << {
ant.propertyfile(file: 'build/resources/main/hibernate.properties') {
entry( key: 'hibernate.connection.datasource', value: db[1] )
entry( key: 'hibernate.dialect', value: db[2] )
}
}
task "${db[0]}War"(type: War, dependsOn: "${db[0]}Hbm") {
baseName = "channel_${db[0]}"
}
task "${db[0]}Ear"(type: Ear, dependsOn: "${db[0]}War") {
baseName = "channel_${db[0]}"
from("$buildDir/libs") {
include "channel_${db[0]}.war"
rename { 'channel.war' }
}
from("src/main/resources") {
include "META-INF/application.xml"
}
}
}
task dists(dependsOn: ['oracleEar', 'sqlserverEar', 'postgresEar'])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment