Hi,

On Feb 22, 2010, at 7:28 PM, Alex Boisvert wrote:

It fails for me with Ant 1.7.1 but works with 1.8.0 so I'd be inclined to
point the finger towards Ant.

Ah, the one variable I didn't try. Curiously it works in both ant 1.7.0 and 1.8.0, but not in 1.7.1.

I didn't look in the Ant sql task code
although I wouldn't be surprised to see a System.exit() somewhere in there
given the abrupt termination behavior.

I spent a little time looking for exit-related oddities in ant 1.7.1 (and, after you pointed it out, differences between 1.8.0 and 1.7.1), but I didn't find anything that explained this behavior (at least to me). I'm sure it's in there somewhere, but I'm happy to switch ant versions and be done with it. I'll report an issue in case someone else runs into this in the future and/or you want to update to ant 1.8.0 as the default.

Thanks,
Rhett


alex



On Mon, Feb 22, 2010 at 5:03 PM, Rhett Sutphin <rh...@detailedbalance.net >wrote:

Hi,

I've been trying to track down an intermittent failure in my build script and I've discovered a repeatable problem with the sql ant task in buildr. When you execute the 'foo:postgresql' task in the buildfile below, the "SQL finished" line is never printed. The SQL gets executed, but then buildr just exits. There's no error and the usual "Completed in ..." message isn't
printed.

If you use an invalid SQL statement (or database, etc.), you get an error from ant which buildr bubbles up, as expected. The behavior seems to be the same with buildr on MRI and JRuby. The problem isn't database- dependent -- I see the same thing with HSQLDB and Oracle. An equivalent ant script
behaves as expected.  If I use the src attribute and an external file
instead of pcdata, I see the same weird behavior.

I use antwrap for other things in my buildfile and none of them act like this. I'll file a bug, but first I wanted to see if 1) anyone else uses the sql ant task in buildr and 2) either does or doesn't have this problem.

Thanks,
Rhett

------ Example buildfile ------

require 'buildr'

repositories.remote << "http://repo1.maven.org/maven2";

define 'foo' do
task 'postgresql' do
  ant('test') do |ant|
    ant.sql :driver => 'org.postgresql.Driver',
      :classpath =>
artifact("postgresql:postgresql:jar:8.2-504.jdbc3").to_s,
      # some actual database
      :url => 'jdbc:postgresql:test',
      # and credentials
      :userid => 'rsutphin',
      :password => '',
      # some valid SQL statement for that database
      :pcdata => "UPDATE sites SET name='foo' WHERE name='foo';"
  end
  info "SQL finished"
end
end


Reply via email to