Skip to content

Commit

Permalink
Added an extra check for the configDropins file. (#251)
Browse files Browse the repository at this point in the history
* Adding extra check to configDropins

* Fixed styling
  • Loading branch information
jjvilleg authored Apr 25, 2018
1 parent 570dc7b commit 3550896
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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())
}
}
Expand Down Expand Up @@ -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
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down

0 comments on commit 3550896

Please sign in to comment.