allprojects { ext.artifactGroup = 'com.company.child' ext.artifactVersion = '1.0' ext.isSnapshot = false ext.tomcatDir = "$rootDir/build/tomcat" ext.copyright = "Copyright (c) 2014 com.company.child" // Copyright Notice for IDEA project // ext.vcs = 'svn' // VCS for IDEA project } buildscript { ext.cubaVersion = '5.1.5' ext.dictionaryVersion = '0.2' repositories { mavenLocal() maven { url 'https://repo.cuba-platform.com/content/groups/work' credentials { username(rootProject.hasProperty('repoUser') ? rootProject['repoUser'] : 'cuba') password(rootProject.hasProperty('repoPass') ? rootProject['repoPass'] : 'cuba123') } } // flatDir dirs: ["C:/Documents and Settings/r.belous/.m2/repository/com/company/parent/dictionary-global/0.1"] } dependencies { classpath "com.haulmont.gradle:cuba-plugin:$cubaVersion" } } def globalModule = project(':child-global') def coreModule = project(':child-core') def guiModule = project(':child-gui') def webModule = project(':child-web') def hsql = 'org.hsqldb:hsqldb:2.2.9' def servletApi = 'org.apache.tomcat:servlet-api:6.0.20' apply(plugin: 'idea') apply(plugin: 'cuba') //apply(plugin: 'dictionary') configure([globalModule, coreModule, guiModule, webModule]) { apply(plugin: 'java') apply(plugin: 'maven') apply(plugin: 'idea') apply(plugin: 'cuba') // apply(plugin: 'dictionary') dependencies { testCompile('junit:junit:4.5') } task sourceJar(type: Jar) { from file('src') classifier = 'sources' } artifacts { archives sourceJar } } configure(globalModule) { dependencies { // compile files('../../../parent/modules/global/build/libs/child-global-0.1-SNAPSHOT.jar') compile("com.company.parent:dictionary-global:$dictionaryVersion") compile("com.haulmont.cuba:cuba-global:$cubaVersion") } task enhance(type: CubaEnhancing) { persistenceXml = "$globalModule.projectDir/src/persistence.xml" } } configure(coreModule) { configurations { jdbc dbscripts } dependencies { compile(globalModule) provided(servletApi) jdbc(hsql) testRuntime(hsql) compile("com.company.parent:dictionary-core:$dictionaryVersion") compile("com.haulmont.cuba:cuba-core:$cubaVersion") testCompile("com.haulmont.cuba:cuba-core:$cubaVersion:tests") testCompile("com.haulmont.cuba:cuba-shared-lib:$cubaVersion") dbscripts("com.haulmont.cuba:cuba-core:$cubaVersion:db@zip") } task deploy(dependsOn: assemble, type: CubaDeployment) { appName = 'child-core' // appJars('cuba-core', 'cuba-global', appJars('cuba-core', 'cuba-global', 'dictionary-core', 'dictionary-global', 'child-global', 'child-core') } task createDb(dependsOn: assemble, description: 'Creates local database', type: CubaDbCreation) { dbms = 'hsql' host = 'localhost' dbName = 'mydb' dbUser = 'sa' dbPassword = '' } task updateDb(dependsOn: assemble, description: 'Updates local database', type: CubaDbUpdate) { dbms = 'hsql' host = 'localhost' dbName = 'mydb' dbUser = 'sa' dbPassword = '' } } configure(guiModule) { dependencies { compile(globalModule) compile("com.company.parent:dictionary-gui:$dictionaryVersion") compile("com.haulmont.cuba:cuba-gui:$cubaVersion") compile("com.haulmont.cuba:cuba-client:$cubaVersion") } task deployConf(type: Copy) { from file('src') include "com/company/child/**" into "$tomcatDir/conf/child" } task clearMessagesCache(type: CubaClearMessagesCache) { appName = 'child' } deployConf.dependsOn clearMessagesCache } configure(webModule) { configurations { webcontent } dependencies { provided(servletApi) compile(globalModule) compile(guiModule) compile("com.company.parent:dictionary-web:$dictionaryVersion") webcontent("com.company.parent:dictionary-web:$dictionaryVersion:web@zip") compile("com.haulmont.cuba:cuba-web:$cubaVersion") webcontent("com.haulmont.cuba:cuba-web:$cubaVersion:web@zip") webcontent("com.haulmont.cuba:cuba-web-toolkit:$cubaVersion:web@zip") } task webArchive(type: Zip) { from file('web') classifier = 'web' } artifacts { archives webArchive } task deployConf(type: Copy) { from file('src') include "com/company/child/**" into "$tomcatDir/conf/child" } task clearMessagesCache(type: CubaClearMessagesCache) { appName = 'child' } deployConf.dependsOn clearMessagesCache task cleanConf(description: 'Cleans up conf directory') << { def dir = new File(tomcatDir, '/conf/child') if (dir.isDirectory()) { ant.delete(includeemptydirs: true) { fileset(dir: dir, includes: '**/*', excludes: 'local.app.properties') } } } task deploy(dependsOn: [assemble, cleanConf], type: CubaDeployment) { appName = 'child' // appJars('cuba-gui', 'cuba-client', 'cuba-web', 'cuba-global', appJars('cuba-gui', 'cuba-client', 'cuba-web', 'cuba-global', 'dictionary-gui', 'dictionary-client', 'dictionary-web', 'dictionary-global', 'child-global', 'child-gui', 'child-web') } } task undeploy(type: Delete, dependsOn: ':child-web:cleanConf') { delete("$tomcatDir/shared") delete("$tomcatDir/webapps/child-core") delete("$tomcatDir/webapps/child") } task restart(dependsOn: ['stop', ':child-core:deploy', ':child-web:deploy'], description: 'Redeploys applications and restarts local Tomcat') << { ant.waitfor(maxwait: 6, maxwaitunit: 'second', checkevery: 2, checkeveryunit: 'second') { not { socket(server: 'localhost', port: '8787') } } start.execute() } task wrapper(type: Wrapper) { gradleVersion = '1.8' }