def component_clone(component)
file(path_to(component[:path], component[:artifact].to_s.pathmap('%f')) => component[:artifact]) do |task|
mkpath task.to_s.pathmap('%d')
cp component[:artifact].to_s, task.to_s
Manifest.update_manifest(task) do |manifest|
class_path = manifest.main['Class-Path'].to_s.split
included_libs = class_path.map { |fn| fn.pathmap('%f') }
Zip::ZipFile.foreach(task.to_s) do |entry|
included_libs << entry.name.pathmap('%f') if entry.file? && entry.name =~ /^WEB-INF\/lib\/[^\/]+$/
end
class_path += libs_classpath(component).reject { |path| included_libs.include?(File.basename(path)) }
manifest.main['Class-Path'] = class_path.join(' ')
end
end
end