Skip to content

Commit

Permalink
fix duplicate application.ini mappings when both BASH and BAT are used
Browse files Browse the repository at this point in the history
  • Loading branch information
dwickern committed Oct 25, 2017
1 parent 9cb7d82 commit 15d685c
Showing 1 changed file with 17 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,17 +21,24 @@ trait ApplicationIniGenerator {
val pathMapping = cleanApplicationIniPath(location)
//Do not use writeLines here because of issue #637
IO.write(configFile, ("# options from build" +: javaOptions).mkString("\n"))
val hasConflict = universalMappings.exists {
case (file, path) => file != configFile && path == pathMapping
}
// Warn the user if he tries to specify options
if (hasConflict) {
log.warn("--------!!! JVM Options are defined twice !!!-----------")
log.warn(
"application.ini is already present in output package. Will be overridden by 'javaOptions in Universal'"
)
val filteredMappings = universalMappings.filter {
case (`configFile`, `pathMapping`) =>
// ignore duplicate application.ini mappings with identical contents
// for example when using both the BASH and BAT plugin
true

case (_, `pathMapping`) =>
// specified a custom application.ini file *and* JVM options
// TODO: merge JVM options into the existing application.ini?
log.warn("--------!!! JVM Options are defined twice !!!-----------")
log.warn(
"application.ini is already present in output package. Will be overridden by 'javaOptions in Universal'"
)
true

case _ => false
}
(configFile -> pathMapping) +: universalMappings
(configFile -> pathMapping) +: filteredMappings

}
.getOrElse(universalMappings)
Expand Down

0 comments on commit 15d685c

Please sign in to comment.