def load(source)
case source
when Hash
load(Buildr.artifact(source).pom)
when Artifact
pom = source.pom
pom.invoke
load(pom.to_s)
when Rake::FileTask
source.invoke
load(source.to_s)
when String
filename = File.expand_path(source)
unless pom = cache[filename]
trace "Loading m2 pom file from #{filename}"
begin
pom = POM.new(IO.read(filename))
rescue REXML::ParseException => e
fail "Could not parse #{filename}, #{e.continued_exception}"
end
cache[filename] = pom
end
pom
else
raise ArgumentError, "Expecting Hash spec, Artifact, file name or file task"
end
end