Hi
On my cuba 7.2 project, each time I build gradle downloads maven-metadata which slows things down.
I found some solutions for a maven project to sort out the issue (e.g change the “updatePolicy”), but nothing for gradle.
Hereunder my build.gradle script in case I missed something obvious. Any help appreciated.
Regards
Michael
buildscript {
ext.cubaVersion = '7.2.10'
repositories {
mavenCentral()
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 'http://repo.e-iceblue.com/nexus/content/groups/public/' }
}
dependencies {
classpath "com.haulmont.gradle:cuba-plugin:$cubaVersion"
}
}
def modulePrefix = 'ibusy2'
def globalModule = project(":${modulePrefix}-global")
def coreModule = project(":${modulePrefix}-core")
def webModule = project(":${modulePrefix}-web")
def webToolkitModule = project(":${modulePrefix}-web-toolkit")
def servletApi = 'javax.servlet:javax.servlet-api:3.1.0'
apply(plugin: 'cuba')
cuba {
artifact {
group = 'com.ibusy2'
version = '0.1'
isSnapshot = true
}
}
dependencies {
appComponent("com.haulmont.cuba:cuba-global:$cubaVersion")
appComponent('com.haulmont.addon.dashboard:dashboard-global:3.2.3')
appComponent('com.haulmont.charts:charts-global:7.2.10')
appComponent("com.haulmont.reports:reports-global:$cubaVersion")
appComponent('com.haulmont.addon.imap:imap-global:1.5.1')
appComponent('com.haulmont.addon.helium:helium-global:0.3.1')
appComponent('com.haulmont.addon.dnd:cuba-dnd-global:1.7.0')
appComponent('com.haulmont.addon.bproc:bproc-global:1.2.0')
appComponent('com.haulmont.addon.globalevents:cubaglevt-global:0.6.1')
appComponent('com.haulmont.addon.emailtemplates:yet-global:1.4.2')
appComponent('com.haulmont.addon.restapi:restapi-global:7.2.3')
appComponent("com.haulmont.fts:fts-global:$cubaVersion")
appComponent('br.com.petersonbr.translations:cuba-translations-addon-global:7.2.2')
}
def postgres = 'org.postgresql:postgresql:42.2.9'
configure([globalModule, coreModule, webModule, webToolkitModule]) {
apply(plugin: 'java')
apply(plugin: 'maven')
apply(plugin: 'cuba')
sourceCompatibility = '11'
targetCompatibility = '11'
dependencies {
testCompile('org.junit.jupiter:junit-jupiter-api:5.5.2')
testCompile('org.junit.jupiter:junit-jupiter-engine:5.5.2')
testCompile('org.junit.vintage:junit-vintage-engine:5.5.2')
}
task sourceJar(type: Jar) {
from file('src')
classifier = 'sources'
}
artifacts {
archives sourceJar
}
test {
useJUnitPlatform()
}
}
configure(globalModule) {
dependencies {
if (!JavaVersion.current().isJava8()) {
compile('javax.xml.bind:jaxb-api:2.3.1')
compile('org.glassfish.jaxb:jaxb-runtime:2.3.1')
}
compile('org.jetbrains:annotations:20.1.0')
compile('org.apache.commons:commons-csv:1.4')
}
entitiesEnhancing {
main {
enabled = true
}
}
}
configure(coreModule) {
configurations {
jdbc
dbscripts
}
dependencies {
compile(globalModule)
compile('net.sf.jasperreports:jasperreports:6.16.0')
compileOnly(servletApi)
jdbc(postgres)
testRuntime(postgres)
compile('e-iceblue:spire.xls.free:2.2.0')
}
task cleanConf(description: 'Cleans up conf directory', type: Delete) {
delete "$cuba.appHome/${modulePrefix}-core/conf"
}
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) {
}
task createTestDb(dependsOn: assembleDbScripts, type: CubaDbCreation) {
dbms = 'postgres'
host = 'localhost'
dbName = 'ibusy2_test'
dbUser = 'cuba'
dbPassword = 'cuba'
}
task updateDb(dependsOn: assembleDbScripts, description: 'Updates local database', type: CubaDbUpdate) {
}
task updateTestDb(dependsOn: assembleDbScripts, description: 'Updates test database', type: CubaDbUpdate) {
dbms = 'postgres'
host = 'localhost'
dbName = 'ibusy2_test'
dbUser = 'cuba'
dbPassword = 'cuba'
}
}
configure(webModule) {
configurations {
webcontent
}
dependencies {
compileOnly(servletApi)
compile(globalModule)
compile('eu.maxschuster:vaadin-signaturefield:2.0.1')
}
jar {
with copySpec {
from sourceSets.main.allJava
include "com/ibusy2/web/toolkit/ui/client/**"
}
}
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/ibusy2/**"
into "$cuba.appHome/${modulePrefix}/conf"
}
task clearMessagesCache(type: CubaClearMessagesCache) {
appName = "${modulePrefix}"
}
deployConf.dependsOn clearMessagesCache
task cleanConf(description: 'Cleans up conf directory', type: Delete) {
delete "$cuba.appHome/${modulePrefix}/conf"
}
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
task themesJar(type: Jar) {
from file('themes')
classifier = 'themes'
}
artifacts {
archives themesJar
}
}
configure(webToolkitModule) {
configurations.compile {
exclude group: 'org.springframework'
exclude group: 'org.springframework.security.oauth'
exclude group: 'org.eclipse.persistence'
exclude group: 'org.codehaus.groovy'
exclude group: 'org.apache.ant'
exclude group: 'org.apache.httpcomponents:httpcore:4.4.12'
exclude group: 'com.sun.mail:javax.mail:1.6.2'
exclude group: 'org.eclipse.jetty'
exclude group: 'com.esotericsoftware'
exclude group: 'com.googlecode'
exclude group: 'net.sourceforge.htmlunit'
exclude group: 'com.sun.mail'
exclude group: 'org.glassfish.jaxb'
exclude group: 'com.haulmont.reports'
exclude group: 'com.haulmont.addon.emailtemplates'
exclude group: 'com.haulmont.addon.helium'
exclude group: 'com.haulmont.addon.imap'
exclude group: 'com.haulmont.addon.bproc'
exclude group: 'com.haulmont.addon.dnd'
exclude group: 'com.haulmont.addon.restapi'
exclude group: 'com.haulmont.addon.dashboard'
exclude group: 'com.google.guava'
exclude group: 'org.apache.httpcomponents'
}
dependencies {
compile(webModule)
}
jar {
from sourceSets.main.allJava
}
task buildWidgetSet(type: CubaWidgetSetBuilding) {
widgetSetClass = 'com.ibusy2.web.toolkit.ui.AppWidgetSet'
shortClassPath = true
}
task debugWidgetSet(type: CubaWidgetSetDebug) {
widgetSetClass = 'com.ibusy2.web.toolkit.ui.AppWidgetSet'
shortClassPath = true
}
task webArchive(dependsOn: buildWidgetSet, type: Jar) {
from file("$buildDir/web")
classifier = 'client'
}
artifacts {
archives webArchive
}
task deploy(dependsOn: webArchive, type: Copy) {
from webArchive
into "$cuba.tomcat.dir/webapps/${modulePrefix}/WEB-INF/lib"
}
}
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", ":${modulePrefix}-web-toolkit:deploy"], description: 'Redeploys applications and restarts local Tomcat') {
doLast {
ant.waitfor(maxwait: 6, maxwaitunit: 'second', checkevery: 2, checkeveryunit: 'second') {
not {
socket(server: 'localhost', port: '8787')
}
}
}
}
restart.finalizedBy start
task buildWar(type: CubaWarBuilding) {
includeJdbcDriver = true
appProperties = ['cuba.automaticDatabaseUpdate': true]
webXmlPath = 'modules/web/web/WEB-INF/single-war-web.xml'
logbackConfigurationFile = 'etc/logback.xml'
}