class Jars::LockDown
def attach_jar_coordinates_from_bundler_dependencies(maven)
def attach_jar_coordinates_from_bundler_dependencies(maven) load_path = $LOAD_PATH.dup require 'bundler' # TODO: make this group a commandline option Bundler.setup('default') maven.property('jars.bundler', true) cwd = File.expand_path('.') Gem.loaded_specs.each do |_name, spec| # if gemspec is local then include all dependencies maven.attach_jars(spec, all_dependencies: cwd == spec.full_gem_path) end rescue LoadError => e if Jars.verbose? warn e.message warn 'no bundler found - ignore Gemfile if exists' end rescue Bundler::GemfileNotFound # do nothing then as we have bundler but no Gemfile rescue Bundler::GemNotFound warn "can not setup bundler with #{Bundler.default_lockfile}" raise ensure $LOAD_PATH.replace(load_path) end