Dear Buildr users
I've tried to create task which copy library files from
local repository on my disc to local war/WEB-INF/lib directory needed by gwt
dev mode.
It should copy library only if there is new update of library in
repository.
I've created file task:
SERVER = group("server-common",
"server-domain"
"server-query", "server-query-api",
:under=>"example", :version=>"0.0.1-SNAPSHOT")
artifacts(SERVER).each do |artif|
warlib = "war/WEB-INF/lib"
targetFile = File.join(warlib, File.basename(artif.to_s))
file targetFile => [artif.to_s] do
puts "file targetFile " + targetFile.to_s
artifName = artif.to_s
cp artifName, warlib
end
task :compile => [targetFile]
end
Unfortunately it does not copy when library in repository is updated.
I've end up with pure ruby solution :
def initlibs
warlib = 'war/WEB-INF/lib/'
if (!File.directory?(warlib))
puts "mkdir " + warlib
mkpath warlib
end
artifacts(SERVER).each do |artif|
artif.invoke
repfile = artif.to_s
libfile = File.join(warlib, File.basename(repfile))
if( libfile =~ /gwt-servlet/ ) #special case for gwt-servlet
libfile = File.join(warlib, "gwt-servlet.jar")
end
if( File.ctime(libfile) < File.ctime(repfile) )
puts "cp #{libfile} , #{repfile}"
cp libfile , repfile
end
end
end
initlibs
Do you know better solution?