From 8d51dd52f4b91b02571973b503186528cd5e918e Mon Sep 17 00:00:00 2001 From: GIP RECIA - Julien Gribonvald Date: Tue, 26 Feb 2019 16:24:17 +0100 Subject: [PATCH] fix: dataImport task should not run tomcatClean and tomcatDeploy tasks This permit to avoid to undeploy and deploy apps when only a dataImport is run Should solve issue #252 --- .../gradle/plugins/GradleTomcatDeployPlugin.groovy | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/buildSrc/src/main/groovy/org/apereo/portal/start/gradle/plugins/GradleTomcatDeployPlugin.groovy b/buildSrc/src/main/groovy/org/apereo/portal/start/gradle/plugins/GradleTomcatDeployPlugin.groovy index cd7b4cf141..1bcf98d1d5 100644 --- a/buildSrc/src/main/groovy/org/apereo/portal/start/gradle/plugins/GradleTomcatDeployPlugin.groovy +++ b/buildSrc/src/main/groovy/org/apereo/portal/start/gradle/plugins/GradleTomcatDeployPlugin.groovy @@ -7,6 +7,9 @@ import org.gradle.api.tasks.Delete class GradleTomcatDeployPlugin implements Plugin { @Override void apply(Project project) { + boolean taskIsDataImport = project.gradle.startParameter.taskNames.any { + it.contains('dataImport') + }; project.task('tomcatClean', type: Delete) { group 'Tomcat' description 'Removes this project from the integrated Tomcat servlet container' @@ -14,6 +17,10 @@ class GradleTomcatDeployPlugin implements Plugin { mustRunAfter project.rootProject.tasks.tomcatInstall doFirst { + if (taskIsDataImport) { + logger.lifecycle "Skipping tomcatClean; dataImport doesn't require tomcatClean" + return + } File serverBase = project.rootProject.file(project.rootProject.ext['buildProperties'].getProperty('server.base')) File deployDir = new File (serverBase, "webapps/${project.name}") logger.lifecycle("Removing deployed application from servlet container at location: ${deployDir}") @@ -27,6 +34,10 @@ class GradleTomcatDeployPlugin implements Plugin { dependsOn 'assemble' doFirst { + if (taskIsDataImport) { + logger.lifecycle "Skipping tomcatDeploy; dataImport doesn't require tomcatDeploy" + return + } File serverBase = project.rootProject.file(project.rootProject.ext['buildProperties'].getProperty('server.base')) File deployDir = new File (serverBase, "webapps/${project.name}") logger.lifecycle("Deploying assembled application to servlet container at location: ${deployDir}")