lib/buildr/openjpa.rb in buildr-1.1.3 vs lib/buildr/openjpa.rb in buildr-1.2.0

- old
+ new

@@ -1,8 +1,10 @@ require "java/java" module Buildr + + # Provides OpenJPA bytecode enhancement and Mapping tool task. Require explicitly using <code>require "buildr/openjpa"</code>. module OpenJPA VERSION = "0.9.7-incubating" REQUIRES = [ "org.apache.openjpa:openjpa-all:jar:#{VERSION}", @@ -22,30 +24,30 @@ def enhance(options) rake_check_options options, :classpath, :properties, :output artifacts = Buildr.artifacts(options[:classpath]).each { |a| a.invoke }.map(&:to_s) + [options[:output].to_s] properties = file(options[:properties]).tap { |task| task.invoke }.to_s - Ant.executable("openjpa") do |ant| + Buildr.ant "openjpa" do |ant| ant.taskdef :name=>"enhancer", :classname=>"org.apache.openjpa.ant.PCEnhancerTask", :classpath=>requires.join(File::PATH_SEPARATOR) ant.enhancer :directory=>options[:output].to_s do - config :propertiesFile=>properties - classpath :path=>artifacts.join(File::PATH_SEPARATOR) + ant.config :propertiesFile=>properties + ant.classpath :path=>artifacts.join(File::PATH_SEPARATOR) end end end def mapping_tool(options) rake_check_options options, :classpath, :properties, :sql, :action artifacts = Buildr.artifacts(options[:classpath]).each{ |a| a.invoke }.map(&:to_s) properties = file(options[:properties].to_s).tap { |task| task.invoke }.to_s - Ant.executable("openjpa") do |ant| + Buildr.ant("openjpa") do |ant| ant.taskdef :name=>"mapping", :classname=>"org.apache.openjpa.jdbc.ant.MappingToolTask", :classpath=>requires.join(File::PATH_SEPARATOR) ant.mapping :schemaAction=>options[:action], :sqlFile=>options[:sql].to_s, :ignoreErrors=>"true" do - config :propertiesFile=>properties - classpath :path=>artifacts.join(File::PATH_SEPARATOR) + ant.config :propertiesFile=>properties + ant.classpath :path=>artifacts.join(File::PATH_SEPARATOR) end end end private