You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by Yanrong Deng <Y-...@wiu.edu> on 2004/05/12 04:08:39 UTC

help!

We want to use ant file to indicate the change of a file. That is, when the 
file is same as before, ant build file will give us a verification message; if 
the file is different from last time, ant build file will return an error 
message.

What we did is like this:
source code is ct.xml:
 <project>
 <target name="GenerateCheckSum">
  <checksum file="x" forceoverwrite="yes" /> 
  <echo>Verification01</echo> 
  </target>
 <target name="SeeIfXChanged">
  <checksum file="x" verifyProperty="XChangedOrNot" /> 
  <echo>Verification 2</echo> 
  </target>
 <target name="ErrorMessageIfXChanged" depends="SeeIfXChanged" 
if="XChangedOrNot">
  <echo>Verification Succeeded</echo> 
  </target>
 </project>

First, we prepared a text file x. This is the file on which we wish to monitor 
changes.

Second, use command to create the MD5 file---x.MD5 for x as below:
	ant -buildfile ct.xml GenerateCheckSum

Third, use command as below to check if the file x has changed by comparing 
this CheckSum with the CheckSum we got in previous step. 
(this time we didn't change file x)
	ant -buildfile ct.xml ErrorMessageIfXChanged
This returned "Verification Succeeded" as we anticipated.
(The debugging revealed that "the project propety XChangedOrNot -> true")

Fourth, we change file x with a text editor.

Fifth, we use command "ant -buildfile ct.xml ErrorMessageIfXChanged >&
DebugOutput" again. The debugging revealed that "the project propety
XChangedOrNot -> false" as expected. Thus, We should not get "Verification
succeeded", since this CheckSum is different from last one because file
x was changed. But the output is "Verification Succeeded". This means
our ant build file didn't work as we inticipated; the problem looks like
the last target of ct.xml, but not doing the "CheckSum". But, we don't
know what's wrong.


Here is the DebugOutput:

Apache Ant version 1.6.0 compiled on December 18 2003
Buildfile: ct.xml
Adding reference: ant.PropertyHelper
Detected Java version: 1.4 in: /usr/java/j2sdk1.4.1_01/jre
Detected OS: Linux
Adding reference: ant.ComponentHelper
Setting ro project property: ant.version -> Apache Ant version 1.6.0 compiled 
on December 18 2003
Setting ro project property: ant.file -> /home/leffstudent/Project/ct.xml
Adding reference: ant.projectHelper
Adding reference: ant.parsing.context
Adding reference: ant.targets
parsing buildfile /home/leffstudent/Project/ct.xml with URI = 
file:///home/leffstudent/Project/ct.xml
Setting ro project property: ant.file.null -> /home/leffstudent/Project/ct.xml
Project base dir set to: /home/leffstudent/Project
 +Target:
 +Target: GenerateCheckSum
 +Target: SeeIfXChanged
 +Target: ErrorMessageIfXChanged
Build sequence for target `ErrorMessageIfXChanged' is [SeeIfXChanged, 
ErrorMessageIfXChanged]
Complete build sequence is [SeeIfXChanged, ErrorMessageIfXChanged, 
GenerateCheckSum, ]

SeeIfXChanged:
Setting project property: XChangedOrNot -> false
     [echo] Verification 2

ErrorMessageIfXChanged:
     [echo] Verification Succeeded

BUILD SUCCESSFUL
Total time: 1 second






---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


RE: Strange out of memory error

Posted by Pawanraj Sadhwani <pa...@elitecore.com>.
Hi All

seems like fork = true was creating a problem. Solved it..

Pawan

-----Original Message-----
From: Pawanraj Sadhwani [mailto:pawanraj@elitecore.com]
Sent: Wednesday, May 12, 2004 11:12 AM
To: 'Ant Users List'
Subject: Strange out of memory error


Hi All,

I am converting all the build scripts in our project to take adv. of ant
1.6.1 features...

In one script, I generate ejb-doclets for various modules using 'macrodef'
for the task. that leads to compile

now.. we have 2500 files for compilation.. And it goes OutOfMemory during
compilation. the funny thing is that the same script works for local
developers on running a clean build.

my ANT_OPTS have -Xmx300m. the only diff i can see is fork="true" for the
javac.

Is that the source of a problem?? what exactly does fork="true" do? AFAIK it
starts a new JVM process. if fork is true, then will the new JVM run with
default memory and heap settings.

I will try with fork="false".. and let you know in 5 mins.. but meanwhile
can i have some insight on the problem?

PAwan


-----Original Message-----
From: Mani G. Iyer [mailto:iyer@rcn.com]
Sent: Wednesday, May 12, 2004 8:04 AM
To: 'Ant Users List'
Subject: RE: help!


Yanrong:

The if attribute  in <target name="ErrorMessageIfXChanged"
depends="SeeIfXChanged"
if="XChangedOrNot">  is executed if the property 'XChangedOrNot" is set
to any value.  So when your target SeeIfXChanged set the property to
"false", the property is set.
One way of coding this is to use condition:

<target name="GenerateCheckSum">
  	<checksum file="x" forceoverwrite="yes" />
	<echo>Verification01</echo>
</target>
<target name="SeeIfXChanged">
  	<checksum file="x" verifyProperty="XChangedOrNot" />
  	<echo>Verification 2</echo>
	<condition property="x.changed">
		<istrue value="${XChangedOrNot}" />
	</condition>
  </target>
  <target name="ErrorMessageIfXChanged" depends="SeeIfXChanged"
	if="x.changed">
  	<echo>Verification Succeeded</echo>
  </target>


HTH
mani


-----Original Message-----
From: Yanrong Deng [mailto:Y-Deng@wiu.edu]
Sent: Tuesday, May 11, 2004 10:09 PM
To: user@ant.apache.org
Subject: help!


We want to use ant file to indicate the change of a file. That is, when
the
file is same as before, ant build file will give us a verification
message; if
the file is different from last time, ant build file will return an
error
message.

What we did is like this:
source code is ct.xml:
 <project>
 <target name="GenerateCheckSum">
  <checksum file="x" forceoverwrite="yes" />
  <echo>Verification01</echo>
  </target>
 <target name="SeeIfXChanged">
  <checksum file="x" verifyProperty="XChangedOrNot" />
  <echo>Verification 2</echo>
  </target>
 <target name="ErrorMessageIfXChanged" depends="SeeIfXChanged"
if="XChangedOrNot">
  <echo>Verification Succeeded</echo>
  </target>
 </project>

First, we prepared a text file x. This is the file on which we wish to
monitor
changes.

Second, use command to create the MD5 file---x.MD5 for x as below:
	ant -buildfile ct.xml GenerateCheckSum

Third, use command as below to check if the file x has changed by
comparing
this CheckSum with the CheckSum we got in previous step.
(this time we didn't change file x)
	ant -buildfile ct.xml ErrorMessageIfXChanged
This returned "Verification Succeeded" as we anticipated.
(The debugging revealed that "the project propety XChangedOrNot ->
true")

Fourth, we change file x with a text editor.

Fifth, we use command "ant -buildfile ct.xml ErrorMessageIfXChanged >&
DebugOutput" again. The debugging revealed that "the project propety
XChangedOrNot -> false" as expected. Thus, We should not get
"Verification
succeeded", since this CheckSum is different from last one because file
x was changed. But the output is "Verification Succeeded". This means
our ant build file didn't work as we inticipated; the problem looks like
the last target of ct.xml, but not doing the "CheckSum". But, we don't
know what's wrong.


Here is the DebugOutput:

Apache Ant version 1.6.0 compiled on December 18 2003
Buildfile: ct.xml
Adding reference: ant.PropertyHelper
Detected Java version: 1.4 in: /usr/java/j2sdk1.4.1_01/jre
Detected OS: Linux
Adding reference: ant.ComponentHelper
Setting ro project property: ant.version -> Apache Ant version 1.6.0
compiled
on December 18 2003
Setting ro project property: ant.file ->
/home/leffstudent/Project/ct.xml
Adding reference: ant.projectHelper
Adding reference: ant.parsing.context
Adding reference: ant.targets
parsing buildfile /home/leffstudent/Project/ct.xml with URI =
file:///home/leffstudent/Project/ct.xml
Setting ro project property: ant.file.null ->
/home/leffstudent/Project/ct.xml
Project base dir set to: /home/leffstudent/Project
 +Target:
 +Target: GenerateCheckSum
 +Target: SeeIfXChanged
 +Target: ErrorMessageIfXChanged
Build sequence for target `ErrorMessageIfXChanged' is [SeeIfXChanged,
ErrorMessageIfXChanged]
Complete build sequence is [SeeIfXChanged, ErrorMessageIfXChanged,
GenerateCheckSum, ]

SeeIfXChanged:
Setting project property: XChangedOrNot -> false
     [echo] Verification 2

ErrorMessageIfXChanged:
     [echo] Verification Succeeded

BUILD SUCCESSFUL
Total time: 1 second






---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org




---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


Strange out of memory error

Posted by Pawanraj Sadhwani <pa...@elitecore.com>.
Hi All,

I am converting all the build scripts in our project to take adv. of ant
1.6.1 features...

In one script, I generate ejb-doclets for various modules using 'macrodef'
for the task. that leads to compile

now.. we have 2500 files for compilation.. And it goes OutOfMemory during
compilation. the funny thing is that the same script works for local
developers on running a clean build.

my ANT_OPTS have -Xmx300m. the only diff i can see is fork="true" for the
javac.

Is that the source of a problem?? what exactly does fork="true" do? AFAIK it
starts a new JVM process. if fork is true, then will the new JVM run with
default memory and heap settings.

I will try with fork="false".. and let you know in 5 mins.. but meanwhile
can i have some insight on the problem?

PAwan


-----Original Message-----
From: Mani G. Iyer [mailto:iyer@rcn.com]
Sent: Wednesday, May 12, 2004 8:04 AM
To: 'Ant Users List'
Subject: RE: help!


Yanrong:

The if attribute  in <target name="ErrorMessageIfXChanged"
depends="SeeIfXChanged"
if="XChangedOrNot">  is executed if the property 'XChangedOrNot" is set
to any value.  So when your target SeeIfXChanged set the property to
"false", the property is set.
One way of coding this is to use condition:

<target name="GenerateCheckSum">
  	<checksum file="x" forceoverwrite="yes" />
	<echo>Verification01</echo>
</target>
<target name="SeeIfXChanged">
  	<checksum file="x" verifyProperty="XChangedOrNot" />
  	<echo>Verification 2</echo>
	<condition property="x.changed">
		<istrue value="${XChangedOrNot}" />
	</condition>
  </target>
  <target name="ErrorMessageIfXChanged" depends="SeeIfXChanged"
	if="x.changed">
  	<echo>Verification Succeeded</echo>
  </target>


HTH
mani


-----Original Message-----
From: Yanrong Deng [mailto:Y-Deng@wiu.edu]
Sent: Tuesday, May 11, 2004 10:09 PM
To: user@ant.apache.org
Subject: help!


We want to use ant file to indicate the change of a file. That is, when
the
file is same as before, ant build file will give us a verification
message; if
the file is different from last time, ant build file will return an
error
message.

What we did is like this:
source code is ct.xml:
 <project>
 <target name="GenerateCheckSum">
  <checksum file="x" forceoverwrite="yes" />
  <echo>Verification01</echo>
  </target>
 <target name="SeeIfXChanged">
  <checksum file="x" verifyProperty="XChangedOrNot" />
  <echo>Verification 2</echo>
  </target>
 <target name="ErrorMessageIfXChanged" depends="SeeIfXChanged"
if="XChangedOrNot">
  <echo>Verification Succeeded</echo>
  </target>
 </project>

First, we prepared a text file x. This is the file on which we wish to
monitor
changes.

Second, use command to create the MD5 file---x.MD5 for x as below:
	ant -buildfile ct.xml GenerateCheckSum

Third, use command as below to check if the file x has changed by
comparing
this CheckSum with the CheckSum we got in previous step.
(this time we didn't change file x)
	ant -buildfile ct.xml ErrorMessageIfXChanged
This returned "Verification Succeeded" as we anticipated.
(The debugging revealed that "the project propety XChangedOrNot ->
true")

Fourth, we change file x with a text editor.

Fifth, we use command "ant -buildfile ct.xml ErrorMessageIfXChanged >&
DebugOutput" again. The debugging revealed that "the project propety
XChangedOrNot -> false" as expected. Thus, We should not get
"Verification
succeeded", since this CheckSum is different from last one because file
x was changed. But the output is "Verification Succeeded". This means
our ant build file didn't work as we inticipated; the problem looks like
the last target of ct.xml, but not doing the "CheckSum". But, we don't
know what's wrong.


Here is the DebugOutput:

Apache Ant version 1.6.0 compiled on December 18 2003
Buildfile: ct.xml
Adding reference: ant.PropertyHelper
Detected Java version: 1.4 in: /usr/java/j2sdk1.4.1_01/jre
Detected OS: Linux
Adding reference: ant.ComponentHelper
Setting ro project property: ant.version -> Apache Ant version 1.6.0
compiled
on December 18 2003
Setting ro project property: ant.file ->
/home/leffstudent/Project/ct.xml
Adding reference: ant.projectHelper
Adding reference: ant.parsing.context
Adding reference: ant.targets
parsing buildfile /home/leffstudent/Project/ct.xml with URI =
file:///home/leffstudent/Project/ct.xml
Setting ro project property: ant.file.null ->
/home/leffstudent/Project/ct.xml
Project base dir set to: /home/leffstudent/Project
 +Target:
 +Target: GenerateCheckSum
 +Target: SeeIfXChanged
 +Target: ErrorMessageIfXChanged
Build sequence for target `ErrorMessageIfXChanged' is [SeeIfXChanged,
ErrorMessageIfXChanged]
Complete build sequence is [SeeIfXChanged, ErrorMessageIfXChanged,
GenerateCheckSum, ]

SeeIfXChanged:
Setting project property: XChangedOrNot -> false
     [echo] Verification 2

ErrorMessageIfXChanged:
     [echo] Verification Succeeded

BUILD SUCCESSFUL
Total time: 1 second






---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org




---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


RE: help!

Posted by "Mani G. Iyer" <iy...@rcn.com>.
Yanrong:

The if attribute  in <target name="ErrorMessageIfXChanged"
depends="SeeIfXChanged" 
if="XChangedOrNot">  is executed if the property 'XChangedOrNot" is set
to any value.  So when your target SeeIfXChanged set the property to
"false", the property is set.
One way of coding this is to use condition:

<target name="GenerateCheckSum">
  	<checksum file="x" forceoverwrite="yes" /> 
	<echo>Verification01</echo> 
</target>
<target name="SeeIfXChanged">
  	<checksum file="x" verifyProperty="XChangedOrNot" /> 
  	<echo>Verification 2</echo> 
	<condition property="x.changed">
		<istrue value="${XChangedOrNot}" />
	</condition>
  </target>
  <target name="ErrorMessageIfXChanged" depends="SeeIfXChanged" 
	if="x.changed">
  	<echo>Verification Succeeded</echo> 
  </target>
 

HTH
mani


-----Original Message-----
From: Yanrong Deng [mailto:Y-Deng@wiu.edu] 
Sent: Tuesday, May 11, 2004 10:09 PM
To: user@ant.apache.org
Subject: help!


We want to use ant file to indicate the change of a file. That is, when
the 
file is same as before, ant build file will give us a verification
message; if 
the file is different from last time, ant build file will return an
error 
message.

What we did is like this:
source code is ct.xml:
 <project>
 <target name="GenerateCheckSum">
  <checksum file="x" forceoverwrite="yes" /> 
  <echo>Verification01</echo> 
  </target>
 <target name="SeeIfXChanged">
  <checksum file="x" verifyProperty="XChangedOrNot" /> 
  <echo>Verification 2</echo> 
  </target>
 <target name="ErrorMessageIfXChanged" depends="SeeIfXChanged" 
if="XChangedOrNot">
  <echo>Verification Succeeded</echo> 
  </target>
 </project>

First, we prepared a text file x. This is the file on which we wish to
monitor 
changes.

Second, use command to create the MD5 file---x.MD5 for x as below:
	ant -buildfile ct.xml GenerateCheckSum

Third, use command as below to check if the file x has changed by
comparing 
this CheckSum with the CheckSum we got in previous step. 
(this time we didn't change file x)
	ant -buildfile ct.xml ErrorMessageIfXChanged
This returned "Verification Succeeded" as we anticipated.
(The debugging revealed that "the project propety XChangedOrNot ->
true")

Fourth, we change file x with a text editor.

Fifth, we use command "ant -buildfile ct.xml ErrorMessageIfXChanged >&
DebugOutput" again. The debugging revealed that "the project propety
XChangedOrNot -> false" as expected. Thus, We should not get
"Verification
succeeded", since this CheckSum is different from last one because file
x was changed. But the output is "Verification Succeeded". This means
our ant build file didn't work as we inticipated; the problem looks like
the last target of ct.xml, but not doing the "CheckSum". But, we don't
know what's wrong.


Here is the DebugOutput:

Apache Ant version 1.6.0 compiled on December 18 2003
Buildfile: ct.xml
Adding reference: ant.PropertyHelper
Detected Java version: 1.4 in: /usr/java/j2sdk1.4.1_01/jre
Detected OS: Linux
Adding reference: ant.ComponentHelper
Setting ro project property: ant.version -> Apache Ant version 1.6.0
compiled 
on December 18 2003
Setting ro project property: ant.file ->
/home/leffstudent/Project/ct.xml
Adding reference: ant.projectHelper
Adding reference: ant.parsing.context
Adding reference: ant.targets
parsing buildfile /home/leffstudent/Project/ct.xml with URI = 
file:///home/leffstudent/Project/ct.xml
Setting ro project property: ant.file.null ->
/home/leffstudent/Project/ct.xml
Project base dir set to: /home/leffstudent/Project
 +Target:
 +Target: GenerateCheckSum
 +Target: SeeIfXChanged
 +Target: ErrorMessageIfXChanged
Build sequence for target `ErrorMessageIfXChanged' is [SeeIfXChanged, 
ErrorMessageIfXChanged]
Complete build sequence is [SeeIfXChanged, ErrorMessageIfXChanged, 
GenerateCheckSum, ]

SeeIfXChanged:
Setting project property: XChangedOrNot -> false
     [echo] Verification 2

ErrorMessageIfXChanged:
     [echo] Verification Succeeded

BUILD SUCCESSFUL
Total time: 1 second






---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org




---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org