Skip to content

Commit

Permalink
fix: dataImport task should not run tomcatClean and tomcatDeploy tasks
Browse files Browse the repository at this point in the history
This permit to avoid to undeploy and deploy apps when only a dataImport is run
Should solve issue #252
  • Loading branch information
jgribonvald committed Feb 26, 2019
1 parent 471f12d commit 8d51dd5
Showing 1 changed file with 11 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,20 @@ import org.gradle.api.tasks.Delete
class GradleTomcatDeployPlugin implements Plugin<Project> {
@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'
dependsOn project.rootProject.tasks.portalProperties
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}")
Expand All @@ -27,6 +34,10 @@ class GradleTomcatDeployPlugin implements Plugin<Project> {
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}")
Expand Down

0 comments on commit 8d51dd5

Please sign in to comment.