Can you reformat and show some samples?

query wrote:
Sorry for the mail format.

The issue with recompilation is not with jar file, but with class files.
When I have already mentioned eg1.jar in classpath, hence compiler shouldn't recompile the common java files while compiling eg2 source files. This issue is arising only with ANT tool. What can be the reason for this?


On Fri, 08 Jun 2007 David Weintraub wrote :
Please, please change your email preferences to not send HTML email
messages! This is a text only list, and I simply cannot read your
email.

I think what you're saying is that you have two directories: eg1 and
eg2. You compile a JAR in ej1, and need that JAR in eg2. However, eg2
recompiles and rebuilds that JAR. There could be several things going
on:

1). Although Ant says it is rebuilding the JAR, it isn't. The task is
executed, but the task does nothing. This is confusing for example,
when you do the "copy" task, and it claims that it is copying files.
However, I know from the time the task takes, nothing is being copied.

2). The other problem could be the way you call the task. Java tasks
will not recompile if the *.class file is newer than the corresponding
*.java file and the *.jar will not rebuild if the *.jar is newer than
the files it is composed of. If you remove the *.java files from the
eg1 jar file, and then you run eg2, it will recompile the *.class
files because they don't exist. Then, it will rebuild the JAR because
the *.jar is older than the *.class files. The *.jar will also be
rebuilt if you include a new META-INF file too.

The solution would be to make sure that the <java> task can easily
compare the *.java files to their corresponding *.class files and to
make sure that none of the files in your *.jar are newer than the
*.jar. Also make sure that you didn't accidentally add a file to the
directory that is being jar'd. I had a friend who created a temporary
file and that caused the *.jar to be rebuilt.

Another possibility is to use the <uptodate> task to only build the
JAR file if all the conditions are correct. The <uptodate> task (and
the Ant Contrib <outofdate> task) are good ways to prevent rebuilding
when Ant's built in rules don't seem to be working.







On 8 Jun 2007 07:23:05 -0000, query <[EMAIL PROTECTED]> wrote:
I have already compiled some java source files using ANT <javac> task and created a 
jar file(eg1.jar). I am using eg1.jar in the classpath to compile files in 
E:\ANTBUILD\eg\eg2\sources.The log shows that in the classpath, it is also including the 
destination folder as a classpath. Is it an expected issue in <javac> task?
[javac] \'-d\'    [javac] \'E:\\ANTBUILD\\eg\\eg2\\ClassFiles\'    [javac] 
\'-classpath\'    [javac] 
\'E:\\ANTBUILD\\eg\\eg2\\ClassFiles;C:\\PROGRA~1\\jdk1.5.0;E:\\ANTBUILD\\eg\\eg1\\eg1.jar
There a few common java source files which are used in both eg1 and eg2 folder. 
As eg1.jar is already having these class files, while compiling eg2 source 
files, it shouldn\'t create these classfiles again. But the class files are 
generated and hence populating eg2.jar file with more class files than 
expected. What may be the reason for this behaviour?
This issue was not observed when I was using some other build tool. Observed 
only in ANT tool.
-- --
David Weintraub
[EMAIL PROTECTED]

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



--
Scot P. Floess
27 Lake Royale
Louisburg, NC  27549

252-478-8087 (Home)
919-392-6730 (Work)

Chief Architect JPlate  http://sourceforge.net/projects/jplate
Chief Architect JavaPIM http://sourceforge.net/projects/javapim

Reply via email to