Last active
April 2, 2021 14:19
-
-
Save ylxs90/eb8e0bbc0f594d1f795f8e5154379fe8 to your computer and use it in GitHub Desktop.
gradle tasks
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def configPath = "H:\\fc\\config" | |
/** | |
* copy spring config file from subprojects to direct path(configPath) | |
*/ | |
task collectConfigFiles() { | |
def path = new File(configPath) | |
path.deleteDir() | |
path.mkdirs() | |
project.subprojects.findAll { it.subprojects.isEmpty() }.each({ p -> | |
p.sourceSets.main.resources.files.each { File file -> | |
def matcher = file.name =~ /application(\-(?<profile>\w{3,5}))?\.((yaml)|(yml))/ | |
if (!matcher.matches()) { | |
return | |
} | |
def profile = matcher.group("profile"); | |
new File("${configPath}${File.separator}${p.name}${profile == null ? "" : "-$profile"}.yaml") << file.text | |
} | |
}) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment