From 3550896a20e090a106de2f4147c51a77061c340a Mon Sep 17 00:00:00 2001 From: Juan Villegas Date: Wed, 25 Apr 2018 13:38:09 -0500 Subject: [PATCH] Added an extra check for the configDropins file. (#251) * Adding extra check to configDropins * Fixed styling --- .../gradle/plugins/tasks/AbstractServerTask.groovy | 14 ++++++++++++-- .../gradle/plugins/tasks/InstallAppsTask.groovy | 14 +------------- 2 files changed, 13 insertions(+), 15 deletions(-) diff --git a/src/main/groovy/net/wasdev/wlp/gradle/plugins/tasks/AbstractServerTask.groovy b/src/main/groovy/net/wasdev/wlp/gradle/plugins/tasks/AbstractServerTask.groovy index b5f30344a..2120f18bd 100644 --- a/src/main/groovy/net/wasdev/wlp/gradle/plugins/tasks/AbstractServerTask.groovy +++ b/src/main/groovy/net/wasdev/wlp/gradle/plugins/tasks/AbstractServerTask.groovy @@ -364,7 +364,7 @@ abstract class AbstractServerTask extends AbstractTask { serverNode.appendNode('installAppsConfigDropins', installAppsConfigDropinsFile.toString()) } } else { - if (!isAppConfiguredInSourceServerXml(getArchiveName(task))) { + if (!isAppConfiguredInSourceServerXml(getArchiveName(task)) || hasConfiguredApp(ApplicationXmlDocument.getApplicationXmlFile(getServerDir(project)))) { serverNode.appendNode('installAppsConfigDropins', installAppsConfigDropinsFile.toString()) } } @@ -515,5 +515,15 @@ abstract class AbstractServerTask extends AbstractTask { else { throw new GradleException("Archive path not found. Supported formats are jar, war, and ear.") } - } + } + + //Checks if there is an app configured in an existing configDropins application xml file + protected boolean hasConfiguredApp(File applicationXmlFile) { + if (applicationXmlFile.exists()) { + ApplicationXmlDocument appXml = new ApplicationXmlDocument() + appXml.createDocument(applicationXmlFile) + return appXml.hasChildElements() + } + return false + } } diff --git a/src/main/groovy/net/wasdev/wlp/gradle/plugins/tasks/InstallAppsTask.groovy b/src/main/groovy/net/wasdev/wlp/gradle/plugins/tasks/InstallAppsTask.groovy index a37930896..1e9bb85c0 100644 --- a/src/main/groovy/net/wasdev/wlp/gradle/plugins/tasks/InstallAppsTask.groovy +++ b/src/main/groovy/net/wasdev/wlp/gradle/plugins/tasks/InstallAppsTask.groovy @@ -312,20 +312,8 @@ class InstallAppsTask extends AbstractServerTask { } } - //Checks if there is an app configured in an existing configDropins application xml file - private boolean hasConfiguredApp(File applicationXmlFile) { - if (applicationXmlFile.exists()) { - ApplicationXmlDocument appXml = new ApplicationXmlDocument() - appXml.createDocument(applicationXmlFile) - return appXml.hasChildElements() - } - return false - } - void createApplicationFolder(String appDir) { - File serverDir = getServerDir(project) - File applicationDirectory = new File(serverDir, appDir) - + File applicationDirectory = new File(getServerDir(project), appDir) try { if (!applicationDirectory.exists()) { applicationDirectory.mkdir()