buildscript {
ext.cubaVersion = '6.10.8'
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')
}
}
maven {
url 'https://repo.cuba-platform.com/content/groups/premium'
credentials {
username(rootProject.hasProperty('premiumRepoUser') ? rootProject['premiumRepoUser'] : System.getenv('CUBA_PREMIUM_USER'))
password(rootProject.hasProperty('premiumRepoPass') ? rootProject['premiumRepoPass'] : System.getenv('CUBA_PREMIUM_PASSWORD'))
}
}
maven {
url "https://mymavenrepo.com/repo/8nW04Xlvs0TNbEzfXmWz"
}
maven {
url 'http://repo.enonic.com/public/'
}
}
dependencies {
classpath "com.haulmont.gradle:cuba-plugin:$cubaVersion"
}
}
def modulePrefix = 'app'
def globalModule = project(":${modulePrefix}-global")
def coreModule = project(":${modulePrefix}-core")
def webModule = project(":${modulePrefix}-web")
def webThemesModule = project(":${modulePrefix}-web-themes")
def servletApi = 'javax.servlet:javax.servlet-api:3.1.0'
apply(plugin: 'idea')
apply(plugin: 'cuba')
cuba {
artifact {
group = 'com.groupstp.rtneo'
version = "0.2a.1"
isSnapshot = true
}
tomcat {
dir = "$project.rootDir/deploy/tomcat"
port = 8888
shutdownPort = 8887
ajpPort = 8886
debugPort = 8885
}
ide {
vcs = 'Git'
}
}
dependencies {
appComponent("com.haulmont.cuba:cuba-global:$cubaVersion")
appComponent("de.diedavids.cuba.dataimport:dataimport-global:0.7.0")
appComponent("com.haulmont.charts:charts-global:$cubaVersion")
appComponent("de.diedavids.cuba.runtimediagnose:runtime-diagnose-global:1.2.0")
appComponent("com.haulmont.addon.admintools:cuba-at-global:1.2.1")
appComponent("com.haulmont.reports:reports-global:$cubaVersion")
appComponent("com.groupstp.fns:fns-global:0.1.1-SNAPSHOT")
appComponent("com.groupstp.workflowstp:wfstp-global:2.0.3")
appComponent("com.groupstp.maintenance:maintenance-global:1.0.3")
appComponent("com.groupstp.eds:eds-global:0.3.1")
appComponent("com.groupstp.datasupplier:dsstp-global:1.1.0")
appComponent("com.groupstp.fias:fias-global:0.3.2a")
appComponent("com.groupstp.import1cstp:import1cstp-global:0.2.2")
}
def postgres = 'org.postgresql:postgresql:9.4.1212'
configure([globalModule, coreModule, webModule]) {
apply(plugin: 'java')
apply(plugin: 'maven')
apply(plugin: 'idea')
apply(plugin: 'cuba')
dependencies {
testCompile('junit:junit:4.12')
}
task sourceJar(type: Jar) {
from file('src')
classifier = 'sources'
}
artifacts {
archives sourceJar
}
}
configure([globalModule, coreModule, webModule]) {
apply(plugin: 'groovy')
sourceSets {
main { groovy { srcDirs = ["src"] } }
test { groovy { srcDirs = ["test"] } }
}
sourceSets.main.output.classesDir = new File(project.buildDir, "classes/main")
sourceSets.test.output.classesDir = new File(project.buildDir, "classes/test")
}
configure(globalModule) {
dependencies {
compile(group: 'com.fasterxml.jackson.core', name: 'jackson-databind', version: '2.9.6')
compile('com.github.javadev:declinationofnames:1.0')
}
entitiesEnhancing {
main {
enabled = true
}
}
}
configure(coreModule) {
configurations {
jdbc
dbscripts
}
dependencies {
compile(globalModule)
provided(servletApi)
jdbc(postgres)
testRuntime(postgres)
}
task cleanConf(description: 'Cleans up conf directory') {
doLast {
def dir = new File(cuba.tomcat.dir, "/conf/${modulePrefix}-core")
if (dir.isDirectory()) {
ant.delete(includeemptydirs: true) {
fileset(dir: dir, includes: '**/*', excludes: 'local.app.properties')
}
}
}
}
task deploy(dependsOn: [assemble, cleanConf], type: CubaDeployment) {
appName = "${modulePrefix}-core"
appJars(modulePrefix + '-global', modulePrefix + '-core')
}
task createDb(dependsOn: assembleDbScripts, description: 'Creates local database', type: CubaDbCreation) {
dbms = 'postgres'
host = 'localhost'
dbName = 'rtneo'
dbUser = 'cuba'
dbPassword = 'cuba'
}
task updateDb(dependsOn: assembleDbScripts, description: 'Updates local database', type: CubaDbUpdate) {
dbms = 'postgres'
host = 'localhost'
dbName = 'rtneo'
dbUser = 'cuba'
dbPassword = 'cuba'
}
}
configure(webModule) {
configurations {
webcontent
}
dependencies {
provided(servletApi)
compile(globalModule)
compile group: 'nl.captcha', name: 'simplecaptcha', version: '1.2.1'
}
task webArchive(type: Zip) {
from file("$buildDir/web")
from file('web')
classifier = 'web'
}
artifacts {
archives webArchive
}
task deployConf(type: Copy) {
from file('src')
include "com/groupstp/rtneo/**"
into "$cuba.tomcat.dir/conf/${modulePrefix}"
}
task clearMessagesCache(type: CubaClearMessagesCache) {
appName = "${modulePrefix}"
}
deployConf.dependsOn clearMessagesCache
task cleanConf(description: 'Cleans up conf directory') {
doLast {
def dir = new File(cuba.tomcat.dir, "/conf/${modulePrefix}")
if (dir.isDirectory()) {
ant.delete(includeemptydirs: true) {
fileset(dir: dir, includes: '**/*', excludes: 'local.app.properties')
}
}
}
}
task deploy(dependsOn: [assemble, cleanConf], type: CubaDeployment) {
appName = "${modulePrefix}"
appJars(modulePrefix + '-global', modulePrefix + '-web')
}
task buildScssThemes(type: CubaWebScssThemeCreation)
task deployThemes(type: CubaDeployThemeTask, dependsOn: buildScssThemes)
assemble.dependsOn buildScssThemes
}
configure(webThemesModule) {
apply(plugin: 'java')
apply(plugin: 'maven')
apply(plugin: 'cuba')
appModuleType = 'web-themes'
buildDir = file('../build/scss-themes')
sourceSets {
main {
java {
srcDir '.'
}
resources {
srcDir '.'
}
}
}
}
task undeploy(type: Delete, dependsOn: ":${modulePrefix}-web:cleanConf") {
delete("$cuba.tomcat.dir/shared")
delete("$cuba.tomcat.dir/webapps/${modulePrefix}-core")
delete("$cuba.tomcat.dir/webapps/${modulePrefix}")
}
task restart(dependsOn: ['stop', ":${modulePrefix}-core:deploy", ":${modulePrefix}-web:deploy"], description: 'Redeploys applications and restarts local Tomcat') {
doLast {
ant.waitfor(maxwait: 6, maxwaitunit: 'second', checkevery: 2, checkeveryunit: 'second') {
not {
socket(server: 'localhost', port: '8885')
}
}
start.execute()
}
}
task wrapper(type: Wrapper) {
gradleVersion = '4.3.1'
}