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
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
ant.config :propertiesFile=>properties
ant.classpath :path=>artifacts.join(File::PATH_SEPARATOR)
end
end
end