Skip to content

Commit 6c9351c

Browse files
dwickernmuuki88
authored andcommitted
fix duplicate application.ini mappings when both BASH and BAT are used (#1056)
1 parent af21f71 commit 6c9351c

File tree

1 file changed

+18
-10
lines changed

1 file changed

+18
-10
lines changed

src/main/scala/com/typesafe/sbt/packager/archetypes/scripts/ApplicationIniGenerator.scala

+18-10
Original file line numberDiff line numberDiff line change
@@ -21,17 +21,25 @@ trait ApplicationIniGenerator {
2121
val pathMapping = cleanApplicationIniPath(location)
2222
//Do not use writeLines here because of issue #637
2323
IO.write(configFile, ("# options from build" +: javaOptions).mkString("\n"))
24-
val hasConflict = universalMappings.exists {
25-
case (file, path) => file != configFile && path == pathMapping
26-
}
27-
// Warn the user if he tries to specify options
28-
if (hasConflict) {
29-
log.warn("--------!!! JVM Options are defined twice !!!-----------")
30-
log.warn(
31-
"application.ini is already present in output package. Will be overridden by 'javaOptions in Universal'"
32-
)
24+
val filteredMappings = universalMappings.filter {
25+
case (`configFile`, `pathMapping`) =>
26+
// ignore duplicate application.ini mappings with identical contents
27+
// for example when using both the BASH and BAT plugin
28+
false
29+
30+
case (_, `pathMapping`) =>
31+
// specified a custom application.ini file *and* JVM options
32+
// TODO: merge JVM options into the existing application.ini?
33+
log.warn("--------!!! JVM Options are defined twice !!!-----------")
34+
log.warn(
35+
"application.ini is already present in output package. Will be overridden by 'javaOptions in Universal'"
36+
)
37+
false
38+
39+
case _ =>
40+
true
3341
}
34-
(configFile -> pathMapping) +: universalMappings
42+
(configFile -> pathMapping) +: filteredMappings
3543

3644
}
3745
.getOrElse(universalMappings)

0 commit comments

Comments
 (0)