ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Stefan Bodewig <>
Subject Re: sqlplus ant task
Date Fri, 28 Jul 2000 13:19:14 GMT
>>>>> "LJ" == Leonardo Junquera <> writes:

 LJ> I am loving ant.  I want to create a new task to execute sqlplus
 LJ> files.

Take a look at the new <sql> task. Maybe this already does what you
want. You'll only need a JDBC driver to your database.

I assume you've read the "Writing your own task" section in the docs
for the rest of the mail.

 LJ> 1) I want to check to make sure sqlplus is in the path statement.

I'd be happy to find a way to check whether I can execute a give
command. I'd add <available executable="..."> immediately.

 LJ> 2) I want it to check that the .sql file exists before running
 LJ> it.  Question: how do I access the path attribute that was set in
 LJ> the <project> element?

Project.getBaseDir. Better yet, either make you setter method
something like setSqlFile(File) and relative paths will be resolved
for you (Project.resolveFile is responsible for this).

 LJ> 3) I want to run it in a specific directory Question: is this
 LJ> built into the task?

Take a look at the Execute and ExecTask classes to see how they do it.

 LJ> 4) I want to require user, password, server and file member
 LJ> variables.  Question: how do you specify that the attribute is
 LJ> required?

There is no explicit way. In your execute method make sure they have
been set and throw a BuildException if they are not.

 LJ> 5) I want to log the output.  Question: is this built into the
 LJ> task object?

Not sure, whether I know what you mean. There are Task.log() methods
responsible for logging messages. If you want to redirect the output
of sqlplus, again take a look at ExecTask and Execute.


View raw message