lib/java/openjpa.rb in buildr-0.16.0 vs lib/java/openjpa.rb in buildr-0.18.0

- old
+ new

@@ -34,19 +34,17 @@ end protected def self.runtool(options) - classpath = REQUIRES + (options[:classpath] || []).collect | (options[:cp] || []).collect - classpath = artifacts(classpath).each { |t| t.invoke if t.respond_to?(:invoke) }.map(&:to_s) - cmd_args = ["-cp", classpath.join(File::PATH_SEPARATOR)] - cmd_args << options[:class] - cmd_args += options[:args].select { |n, v| v }.map { |n, v| [ n, v ] }.flatten - cmd_args << { :verbose=>options[:verbose] } - unless options[:noop] - verbose { puts "Running OpenJPA #{options[:name]}" } - sh(Java.path_to_bin("java"), *cmd_args) { |ok, res| fail "Failed to execute OpenJPA #{options[:name]}, see errors above" unless ok } - end + args = [options[:class]] + options[:args].select { |n, v| v }.map { |n, v| [ n, v ] }.flatten + args << { :classpath=>requires + (options[:classpath] || []), + :name=>"OpenJPA #{options[:name]}", :verbose=>options[:verbose] } + java *args + end + + def self.requires() + @required ||= artifacts(REQUIRES).each { |artifact| artifact.invoke }.map(&:to_s) end end end