John Shott wrote:
Ant community:

I'm trying to upgrade my build.xml to be ant 1.7.0 compatible and seem to be stumbling on changes in the SQL task related to resource collections.

I have been trying:

       <sql driver="${jdbc_driver_class}" url="${jdbc_url}"
         userid="${this.user}" password="${this.password}"
keepformat="true" delimiter="/" escapeprocessing="false" print="true"
         onerror="continue">
         <fileset dir="${this.dir}">
           <include name="*.sql"/>
           <modified>
             <param name="cache.cachefile" value="./sql.properties"/>
           </modified>
         </fileset>
         <classpath>
           <pathelement location="${build.dir}/${jdbc.jar}"/>
         </classpath>
       </sql>

I keep getting the error message: "Source file or resource collection, transactions, or sql statement must be set!". I thought that a fileset WAS a resource collection and the manual says:

You can specify multiple sources via nested resource collection elements. Each resource of the collection will be run in a transaction of its own. Prior to Ant 1.7 only filesets were supported. Use a sort resource collection to get a predictable order of transactions.

which, to me at least, indicates that a fileset should still be supported.
Can anyone shed some light on this or help me to see what I've fouled up here? I can't seem to figure out what I'm doing wrong.


the fileset should be supported; as you say -it is an RC.


1. you see that message if you have nothing to ussue
           if (srcFile == null && sqlCommand.length() == 0
                && resources.size() == 0) {
                if (transactions.size() == 0) {
throw new BuildException("Source file or resource collection, " + "transactions or sql statement " + "must be set!", getLocation());
                }

2. adding a fileset adds it as a resource

    /**
     * Adds a set of files (nested fileset attribute).
     * @param set a set of files contains SQL commands, each File is run in
     *            a separate transaction.
     */
    public void addFileset(FileSet set) {
        add(set);
    }

    /**
     * Adds a collection of resources (nested element).
     * @param rc a collection of resources containing SQL commands,
     * each resource is run in a separate transaction.
     * @since Ant 1.7
     */
    public void add(ResourceCollection rc) {
        resources.add(rc);
    }

So, assuming the file is added, maybe size() function returns 0.

    public synchronized int size() {
        if (isReference()) {
return ((BaseResourceCollectionContainer) getCheckedRef()).size();
        }
        dieOnCircularReference();
        return cacheCollection().size();
    }

So, it just returns the size of the #of added elements. Which should be >0. In theory, all should be well.

What does a -debug run say?

--
Steve Loughran                  http://www.1060.org/blogxter/publish/5
Author: Ant in Action           http://antbook.org/

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to