ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Alan Pearlman Spencer" <>
Subject RE: How do i do this?
Date Thu, 08 Nov 2001 12:37:20 GMT
The way I would deal with this is to not put the created .java files in
a directory called source, as you say, it is not the 'source' it is
a 'product'. Since the SQLJ command will not let you pur the .java files
in a 
different directory, I would do a copy first:
- Copy **.sqlj to an intermediate directory structure
- Run the command here
- Then have javac take 2 filesets, src and intermediate...

This is the way I deal with intermediate generated files (like .class
files in
a build that is meant to finish up with jars...)

Hope this helps,


-----Original Message-----
From: ArindamR@NIIT.COM [mailto:ArindamR@NIIT.COM]
Sent: 08 November 2001 12:13
Subject: RE: How do i do this?

Before I answer the question a bit of background of SQLJ.

SQLJ allows you to SQL statements in Java files as normal SQL statements
against sending the SQL statements as a string parameter to JDBC calls.
keeps the Code clean. The SQLJ Pre-Compiler processes the .sqlj files
generates a .java file with appropriate JDBC calls and a .ser file which
contains information about the SQL statements, input parameters and

The .java file gets saved in the same directory as that of .sqlj files,
while the .ser files gets saved in a directory passed to the SQLJ
precompiler command. In my case the build directory, which contains all
class files.

Here is how I execute the SQL command with ANT:
	<target description="Pre-Compile SQLJ Files" name="sqlj">
		<apply executable="sqlj" dest="${}"
skipemptyfilesets="true" parallel="true" type="file" failonerror="false"
			<!-- Set the Environment Classpath -->
			<env key="classpath"
			<!-- SQLJ Arguments -->
			<arg value="-d=${}"/>
			<arg value="-compile=no"/>
			<arg value="-checkfilename=yes"/>
			<arg value="-status=yes"/>
			<arg value="-compiler-executable=jikes"/>
			<!-- SQLJ Files -->
			<fileset dir="${dir.src}">
					<include name="**/*.sqlj"/>
			<!-- Mapping to OutputFiles -->
			<mapper type="glob" from="*.sqlj"

After the above target executes on a file in my source directory
${dir.src}/com/niit/objs/ABC.sqj, the following files are generated:
1. ${dir.src}/com/niit/objs/
2. ${}/com/niit/objs/ABC_SJProfile0.ser

After this target execute, I compile all the .java files in my source
directory. After the java compilation ${dir.src}/com/niit/objs/
is a
redundant file in my source directory. I want to remove this file as I
want any developer to accidently edit this file.

I hope I was able to represent my problem.


-----Original Message-----
From: 	Alan Pearlman Spencer
Sent:	Thursday, November 08, 2001 3:17 PM
To:	Ant Users List
Subject:	RE: How do i do this?

Is this so you can recreate them?
Maybe you should use <apply> to have the compiler (sqlj?) run
on the changed files only?

<apply executable="sqlj?" dest="src/JAVA" parallel="false">
  <arg value="-c"/>
  <arg value="-o"/>
  <fileset dir="src/SQL" includes="*.sqlj"/>
  <mapper type="glob" from="*.sqlj" to="*.java"/>

-----Original Message-----
From: ArindamR@NIIT.COM [mailto:ArindamR@NIIT.COM]
Sent: 08 November 2001 05:28
Subject: How do i do this?


I want to achieve the following functionality:

Remove all *.java files for which there is a corresponding .sqlj file.
e.g. if I have a.sqlj and b.sqlj in my source file directory, delete the
corresponding and Although I can achieve this
using <script> task, is there any other way of doing this?



To unsubscribe, e-mail:
For additional commands, e-mail:

To unsubscribe, e-mail:
For additional commands, e-mail:

To unsubscribe, e-mail:
For additional commands, e-mail:

To unsubscribe, e-mail:   <>
For additional commands, e-mail: <>

View raw message