Files
cbsnexora-backend/mifosng-provider/build.gradle
T
2013-05-07 14:27:26 +01:00

411 lines
14 KiB
Groovy

description = '''\
Run as:
gradle clean tomcatrunwar
'''
buildscript {
repositories {
mavenLocal()
mavenCentral()
mavenRepo(name: 'zt-public-snapshots',
url: 'http://repos.zeroturnaround.com/nexus/content/groups/zt-public/')
}
dependencies {
classpath group: 'org.zeroturnaround', name: 'gradle-jrebel-plugin', version: '1.0.2-SNAPSHOT'
}
}
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'org.gradle.api.plugins:gradle-tomcat-plugin:0.9.8'
}
}
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'nl.javadude.gradle.plugins:license-gradle-plugin:0.5.0'
}
}
apply plugin: 'rebel'
apply plugin: 'license'
apply plugin: 'war'
apply plugin: 'eclipse'
apply plugin: 'idea'
apply plugin: 'tomcat'
apply plugin: 'project-report'
/* define the valid syntax level for source files */
sourceCompatibility = JavaVersion.VERSION_1_6
/* define binary compatiblity version */
targetCompatibility = JavaVersion.VERSION_1_6
project.ext.springVersion = '3.2.2.RELEASE'
project.ext.springSecurityVersion = '3.1.3.RELEASE'
project.ext.hibernateValidatorVersion = '4.3.1.Final'
project.ext.hibernateCoreVersion = '4.1.9.Final'
project.ext.jerseyVersion = '1.17'
project.ext.springDataJpaVersion = '1.2.1.RELEASE'
project.ext.mysqlUser='root'
project.ext.mysqlPassword='mysql'
group = 'org.mifosplatform'
repositories {
mavenCentral()
mavenLocal()
maven {
url "http://maven.springframework.org/release"
}
maven {
url "http://download.java.net/maven/2"
}
maven {
url "http://repository.pentaho.org/artifactory/pentaho/"
}
}
configurations {
providedCompile
compile
runtime
all*.exclude group: 'commons-logging'
}
dependencies {
def tomcatVersion = '7.0.39'
tomcat "org.apache.tomcat.embed:tomcat-embed-core:${tomcatVersion}",
"org.apache.tomcat.embed:tomcat-embed-logging-juli:${tomcatVersion}"
tomcat("org.apache.tomcat.embed:tomcat-embed-jasper:${tomcatVersion}") {
exclude group: 'org.eclipse.jdt.core.compiler', module: 'ecj'
}
tomcat "org.apache.tomcat:tomcat-dbcp:${tomcatVersion}"
providedCompile(
[group: 'javax.servlet', name: 'servlet-api', version: '2.5'],
)
compile(
[group: 'org.springframework', name: 'spring-core', version: springVersion],
[group: 'org.springframework', name: 'spring-aspects', version: springVersion],
[group: 'org.springframework', name: 'spring-web', version: springVersion],
[group: 'org.springframework.security', name: 'spring-security-core', version: springSecurityVersion],
[group: 'org.springframework.security', name: 'spring-security-web', version: springSecurityVersion],
[group: 'org.springframework.security', name: 'spring-security-config', version: springSecurityVersion],
[group: 'org.aspectj', name: 'aspectjrt', version: '1.7.0.RELEASE'],
[group: 'org.hibernate', name: 'hibernate-core', version: hibernateCoreVersion],
[group: 'org.hibernate', name: 'hibernate-entitymanager', version: hibernateCoreVersion],
[group: 'org.hibernate.javax.persistence', name: 'hibernate-jpa-2.0-api', version: '1.0.1.Final'],
[group: 'javax.ws.rs', name: 'jsr311-api', version: '1.1.1'],
[group: 'com.sun.jersey', name: 'jersey-core', version: jerseyVersion],
[group: 'com.sun.jersey', name: 'jersey-servlet', version: jerseyVersion],
[group: 'com.sun.jersey', name: 'jersey-server', version: jerseyVersion],
[group: 'com.sun.jersey', name: 'jersey-json', version: jerseyVersion],
[group: 'com.sun.jersey.contribs', name: 'jersey-spring', version: jerseyVersion],
[group: 'com.sun.jersey.contribs', name: 'jersey-multipart', version: jerseyVersion],
[group: 'com.google.code.gson', name: 'gson', version: '2.2.2'],
[group: 'com.google.guava', name: 'guava', version: '14.0-rc2'],
[group: 'org.springframework.data', name: 'spring-data-jpa', version: springDataJpaVersion],
[group: 'joda-time', name: 'joda-time', version: '2.1'],
[group: 'net.sourceforge.javacsv', name: 'javacsv', version: '2.0'],
[group: 'org.apache.commons', name: 'commons-email', version: '1.2'],
[group: 'commons-lang', name: 'commons-lang', version: '2.4'],
[group: 'org.slf4j', name: 'slf4j-api', version: '1.7.2'],
[group: 'org.slf4j', name: 'jcl-over-slf4j', version: '1.7.2'],
[group: 'ch.qos.logback', name: 'logback-core', version: '1.0.9'],
[group: 'ch.qos.logback', name: 'logback-classic', version: '1.0.9'],
[group: 'mysql', name: 'mysql-connector-java', version: '5.1.25'],
[group: 'org.apache.tomcat', name: 'tomcat-jdbc', version: '7.0.39'],
[group: 'pentaho-reporting-engine', name: 'pentaho-reporting-engine-classic-core', version: '3.9.1.1'],
[group: 'pentaho-reporting-engine', name: 'pentaho-reporting-engine-classic-extensions', version: '3.9.1-GA'],
[group: 'pentaho-reporting-engine', name: 'pentaho-reporting-engine-classic-extensions-scripting', version: '3.9.1-GA'],
[group: 'pentaho-reporting-engine', name: 'pentaho-reporting-engine-wizard-core', version: '3.9.1-GA'],
[group: 'pentaho-report-designer', name: 'pentaho-reporting-engine-wizard-xul', version: '3.9.1-GA'],
[group: 'pentaho-library', name: 'libbase', version: '1.2.8'],
[group: 'pentaho-library',name: 'libdocbundle', version: '1.2.8'],
[group: 'pentaho-library',name: 'libfonts', version: '1.2.8'],
[group: 'pentaho-library',name: 'libformat', version: '1.2.8'],
[group: 'pentaho-library',name: 'libformula', version: '1.2.8'],
[group: 'pentaho-library',name: 'libloader', version: '1.2.8'],
[group: 'pentaho-library',name: 'librepository', version: '1.2.8'],
[group: 'pentaho-library',name: 'libserializer', version: '1.2.8'],
[group: 'pentaho-library',name: 'libsparkline', version: '1.2.8'],
[group: 'pentaho-library',name: 'libxml', version: '1.2.8'],
[group: 'org.apache.poi',name: 'poi', version: '3.9'],
[group: 'org.apache.poi',name: 'poi-ooxml', version: '3.9'],
[group: 'org.apache.poi',name: 'poi-ooxml-schemas', version: '3.9'],
[group: 'com.lowagie', name: 'itext', version: '2.1.7'],
[group: 'com.lowagie', name: 'itext-rtf', version: '2.1.7'],
[group: 'org.mnode.ical4j', name: 'ical4j', version: '1.0.4'],
[group: 'com.googlecode.flyway', name: 'flyway-maven-plugin', version: '2.1.1'],
[group: 'org.quartz-scheduler', name: 'quartz', version: '2.1.7']
)
testCompile 'junit:junit:4.11',
'org.mockito:mockito-all:1.9.5',
'com.jayway.restassured:rest-assured:1.7.2'
}
task dist(type:Zip){
baseName= 'mifosplatform'
version = qualifyVersionIfNecessary(releaseVersion)
from('../') {
fileMode = 0755
include '*.md'
}
from('../apps') {
fileMode = 0755
include '*.md'
into('apps')
}
from('src/main/pentahoReports/') {
fileMode = 0755
include '*'
into('pentahoReports')
}
from('../api-docs/') {
fileMode = 0755
include '*'
into('api-docs')
}
from('../mifosng-db/') {
fileMode = 0755
include '*.sql'
into('database')
}
from('../mifosng-db/migrations') {
fileMode = 0755
include '**/*'
into('database/migrations')
}
from war.outputs.files
into(baseName + '-' + version)
}
task deployPentahoReports() {
def pentahoReportDir = System.properties['user.home'] + System.properties['file.separator'] + '.mifosx' + System.properties['file.separator'] + 'pentahoReports'
copy {
from "src/main/pentahoReports"
into pentahoReportDir
}
doLast {
println ':deployPentahoReports - moving pentaho reports under: ' + pentahoReportDir
}
}
war {
it.dependsOn deployPentahoReports
from ('../mifosng-db/migrations/core_db') {
into "WEB-INF/classes/sql"
}
}
license {
header rootProject.file('../LICENSE.MD')
strictCheck true
}
tomcatRun {
httpPort = 8080
httpsPort = 8443
stopPort = 8081
stopKey= 'stopKey'
enableSSL = true
configFile = file('src/test/resources/META-INF/context.xml')
}
tomcatRunWar {
httpPort = 8080
httpsPort = 8443
stopPort = 8081
stopKey= 'stopKey'
enableSSL = true
keystoreFile = file('../keystore.jks')
keystorePass = 'openmf'
configFile = file('src/test/resources/META-INF/context.xml')
}
sourceSets {
integrationTest {
}
}
configurations {
integrationTestCompile.extendsFrom testCompile
integrationTestRuntime.extendsFrom testRuntime
}
task integrationTest(type:Test){
description = "Run integration tests (located in src/integrationTest/java). Starts tomcat in daemon mode before executing the tests."
it.dependsOn war
doFirst {
tomcatRunWar.daemon = true
tomcatRunWar.execute()
}
testClassesDir = project.sourceSets.integrationTest.output.classesDir
classpath = project.sourceSets.integrationTest.runtimeClasspath
}
import groovy.sql.Sql
repositories {
mavenCentral()
}
configurations {
driver
}
dependencies {
driver 'mysql:mysql-connector-java:5.1.16'
}
URLClassLoader loader = GroovyObject.class.classLoader
configurations.driver.each {File file ->
loader.addURL(file.toURL())
}
task createDB<<{
description= "Creates the Database. Needs database name to be passed (like: -PdbName=someDBname)"
sql = Sql.newInstance( 'jdbc:mysql://localhost:3306/', mysqlUser, mysqlPassword, 'com.mysql.jdbc.Driver' )
sql.execute( 'create database '+"`$dbName`" )
}
task dropDB<<{
description= "Drops the specified database. The database name has to be passed (like: -PdbName=someDBname)"
sql = Sql.newInstance( 'jdbc:mysql://localhost:3306/', mysqlUser, mysqlPassword, 'com.mysql.jdbc.Driver' )
sql.execute( 'DROP DATABASE '+"`$dbName`")
}
task setBlankPassword<<{
sql = Sql.newInstance( 'jdbc:mysql://localhost:3306/', mysqlUser, mysqlPassword, 'com.mysql.jdbc.Driver' )
sql.execute('USE `mifosplatform-tenants`')
sql.execute('UPDATE mifosplatform-tenants.tenants SET schema_server = \'localhost\', schema_server_port = \'3306\', schema_username = \'mifos\', schema_password = \'mysql\' WHERE id=1;')
}
apply plugin: 'flyway'
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.github.ben-manes:gradle-flyway-plugin:0.2'
classpath 'mysql:mysql-connector-java:5.1.22'
}
}
flyway {
url = "jdbc:mysql://localhost:3306/mifostenant-default"
user = mysqlUser
password = mysqlPassword
def filePath = "filesystem:$projectDir" + System.properties['file.separator'] + '..' + System.properties['file.separator'] + 'mifosng-db' + System.properties['file.separator'] + 'migrations'
locations = [filePath]
}
task migrateTenantDB<<{
description="Migrates a Tenant DB. Optionally can pass dbName. Defaults to 'mifostenant-default' (Example: -PdbName=someTenantDBname)"
def filePath = "filesystem:$projectDir" + System.properties['file.separator'] + '..' + System.properties['file.separator'] + 'mifosng-db' + System.properties['file.separator'] + 'migrations/core_db'
def tenantDbName = 'mifostenant-default';
if (rootProject.hasProperty("dbName")) {
tenantDbName = rootProject.getProperty("dbName")
}
flyway.url= "jdbc:mysql://localhost:3306/$tenantDbName"
flyway.locations= [filePath]
flywayMigrate.execute()
}
task showTenantDBInfo<<{
description="Shows the migration info for a Tenant DB. Optionally can pass dbName. Defaults to 'mifostenant-default' (Example: -PdbName=someTenantDBname)"
def filePath = "filesystem:$projectDir" + System.properties['file.separator'] + '..' + System.properties['file.separator'] + 'mifosng-db' + System.properties['file.separator'] + 'migrations/core_db'
def tenantDbName = 'mifostenant-default';
if (rootProject.hasProperty("dbName")) {
tenantDbName = rootProject.getProperty("dbName")
}
flyway.url= "jdbc:mysql://localhost:3306/$tenantDbName"
flyway.locations= [filePath]
flywayInfo.execute()
}
task migrateTenantListDB<<{
description="Migrates a Tenant List DB. Optionally can pass dbName. Defaults to 'mifosplatform-tenants' (Example: -PdbName=someDBname)"
def filePath = "filesystem:$projectDir" + System.properties['file.separator'] + '..' + System.properties['file.separator'] + 'mifosng-db' + System.properties['file.separator'] + 'migrations/list_db'
def tenantsDbName = 'mifosplatform-tenants';
if (rootProject.hasProperty("dbName")) {
tenantsDbName = rootProject.getProperty("dbName")
}
flyway.url= "jdbc:mysql://localhost:3306/$tenantsDbName"
flyway.locations= [filePath]
flywayMigrate.execute()
}
task showTenantListDBInfo<<{
description="Shows the migration info for a List DB. Optionally can pass dbName. Defaults to 'mifosplatform-tenants' (Example: -PdbName=someDBname)"
def filePath = "filesystem:$projectDir" + System.properties['file.separator'] + '..' + System.properties['file.separator'] + 'mifosng-db' + System.properties['file.separator'] + 'migrations/list_db'
def tenantsDbName = 'mifosplatform-tenants';
if (rootProject.hasProperty("dbName")) {
tenantsDbName = rootProject.getProperty("dbName")
}
flyway.url= "jdbc:mysql://localhost:3306/$tenantsDbName"
flyway.locations= [filePath]
flywayInfo.execute()
}
/*
* Support publication of artifacts versioned by topic branch.
* CI builds supply `-P BRANCH_NAME=<TOPIC>` to gradle at build time.
* If <TOPIC> starts with 'MIFOSX-', change version
* from BUILD-SNAPSHOT => <TOPIC>-SNAPSHOT
* e.g. 1.1.0.BUILD-SNAPSHOT => 1.0.0.MIFOSX-1234-SNAPSHOT
*/
def qualifyVersionIfNecessary(version) {
if (rootProject.hasProperty("BRANCH_NAME")) {
def qualifier = rootProject.getProperty("BRANCH_NAME")
if (qualifier.startsWith("MIFOSX-")) {
return version.replace('BUILD', qualifier)
}
}
return version
}