Skip to content

Commit 839b78c

Browse files
committed
do not possibly include default jars twice (when filtering with move_jars_to_webinf_lib)
1 parent 27e3acb commit 839b78c

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

lib/warbler/traits/war.rb

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,8 @@ def add_gemjar(jar)
134134
def move_jars_to_webinf_lib(jar, selector = nil)
135135
return unless selector # default is false
136136
selector = /.*/ if selector == true # move all if not a RegExp given
137-
default_jars = default_jar_files.map { |file| File.basename(file) }
137+
default_jar_paths = default_jar_files
138+
default_jars = default_jar_paths.map { |file| File.basename(file) }
138139
jar.files.keys.select { |k| k =~ /^WEB-INF\/.*\.jar$/ }.each do |k|
139140
if k.start_with?('WEB-INF/lib/') # .jar already in WEB-INF/lib
140141
if default_jars.include? k.sub('WEB-INF/lib/', '')
@@ -144,6 +145,8 @@ def move_jars_to_webinf_lib(jar, selector = nil)
144145
next
145146
end
146147
next unless selector =~ File.basename(k)
148+
# default jars might end up mapped twice as they're part of gems
149+
next if default_jar_paths.include?(jar.files[k])
147150
name = k.sub('WEB-INF', '')[1..-1].gsub(/[\/\\]/, '-')
148151
jar.files["WEB-INF/lib/#{name}"] = jar.files[k]
149152
jar.files[k] = empty_jar

0 commit comments

Comments
 (0)