You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by "Varnavas, Frank" <fr...@gs.com> on 2001/06/01 19:25:36 UTC
patch: handling of nonexistent directories
I had a requirement that a list of named jar files be resolved in several
'well-known' locations, taking the first one found.
In this case the directories specified may or may not exist.
I could not find any way in ant 1.3 to do it. Ultimately I wrote a patch
that modifies the behavior of fileset such that
1) the directory need not exist at the time the fileset is created
2) the scan for files will just return no matches if the directory does not
exist.
The build.xml now looks like:
<!-- comma-separated list of required jars -->
<property name="project.jars" value="foundation.jar" />
<path id="project.classpath">
<pathelement path="${std.classpath}"/>
<fileset dir="${local.dir}/jar >
<include name="${project.jars}" />
</fileset>
<fileset dir="${master.dir}/jar >
<include name="${project.jars}" />
</fileset>
<pathelement path="${std.jars}"/>
</path>
In the above the master.dir and local.dir may or may not exist.
The patch:
*** jakarta-ant-1.3/src/main/org/apache/tools/ant/DirectoryScanner.java Fri
Mar 2 07:46:37 2001
--- jakarta-ant-1.3.new/src/main/org/apache/tools/ant/DirectoryScanner.java
Fri Jun 1 12:43:25 2001
***************
*** 651,663 ****
if (basedir == null) {
throw new IllegalStateException("No basedir set");
}
! if (!basedir.exists()) {
! throw new IllegalStateException("basedir does not exist");
! }
! if (!basedir.isDirectory()) {
! throw new IllegalStateException("basedir is not a directory");
! }
!
if (includes == null) {
// No includes supplied, so set it to 'matches all'
includes = new String[1];
--- 651,657 ----
if (basedir == null) {
throw new IllegalStateException("No basedir set");
}
!
if (includes == null) {
// No includes supplied, so set it to 'matches all'
includes = new String[1];
***************
*** 674,680 ****
dirsNotIncluded = new Vector();
dirsExcluded = new Vector();
! scandir(basedir, "", true);
}
/**
--- 668,676 ----
dirsNotIncluded = new Vector();
dirsExcluded = new Vector();
! if ( basedir.exists() && basedir.isDirectory() ) {
! scandir(basedir, "", true);
! }
}
/**
*** jakarta-ant-1.3/src/main/org/apache/tools/ant/types/FileSet.java Fri
Mar 2 07:46:38 2001
--- jakarta-ant-1.3.new/src/main/org/apache/tools/ant/types/FileSet.java
Fri Jun 1 12:43:49 2001
***************
*** 116,127 ****
throw tooManyAttributes();
}
- if (!dir.exists()) {
- throw new BuildException(dir.getAbsolutePath()+" not found.");
- }
- if (!dir.isDirectory()) {
- throw new BuildException(dir.getAbsolutePath()+" is not a
directory.");
- }
this.dir = dir;
}
--- 116,121 ----
SQLExec Mod
Posted by Brett Knights <br...@knightsofthenet.com>.
Hi,
I have made a couple of modifications to <sql> task that others might find useful.
I do a great deal of db work and wanted to use ant to submit my stored procedure scripts.
I modified the sql task as follows:
Added attribute batchsep to allow a user to override the embedded oracle batch separator (oracle uses ';' ms-sql uses 'go')
Added support for <fileset> elements to be nested in <transaction>. This will expand the fileset and submit one transaction for each
matching file.
Modified embedded comment handling. It wouldn't work as it was with sql server. I believe it will still work with oracle.
How would I go about getting this change added to ant as a permanent addition?