You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ant.apache.org by Jhair Tocancipa Triana <jh...@gmx.net> on 2006/06/28 16:38:17 UTC
ResourceUtils.selectOutOfDateSources: ant rebuilds class file again?
[My apologies if this question is more appropiate for the users
list. I tested the following with sources from the SVN repository].
Please consider the test case below:
http://people.freenet.de/jtocancipa/ant_test_case.tgz
$ tar tvzf ant_test_case.tgz
-rw-r--r-- user/users 257 2006-06-28 15:25:01 build.xml
drwxr-xr-x user/users 0 2006-06-28 15:40:48 src/com/
drwxr-xr-x user/users 0 2006-06-28 15:40:56 src/com/icon/
drwxr-xr-x user/users 0 2006-06-28 15:37:07 src/com/icon/common/
-rw-r--r-- user/users 149 2006-06-28 15:35:42 src/com/icon/common/TestAnt.java
When I run ant over this dummy example more than once, the
classes/com/icon/common/TestAnt.class is generated everytime again --
it shouldn't if the TestAnt.java file hasn't been modified.
ant -verbose says the following:
compile:
[javac] TestAnt.java added as TestAnt.class doesn't exist.
The file classes/com/icon/common/TestAnt.class exists though.
I don't know much about ant internals, but I am interested to
learn. So I tried to debug this to see why this was happening. I set a
breakpoint in org.apache.tools.ant.util.ResourceUtils:174.
main[1] print granularity
granularity = 1000
main[1] print sr
sr = "TestAnt.java"
main[1] print r
r = "<directory>/classes/TestAnt.class"
Since <directory>/classes/TestAnt.class does not exist, the
TestAnt.java file is compiled again.
On the other hand the file
<directory>/classes/com/icon/common/Test.class
*does* exist.
Why does ant look for the .class file in the "wrong" directory
(i.e. classes instead classes/com/icon/common)?
Thanks in advance for your help,
--
--Jhair
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org
Re: ResourceUtils.selectOutOfDateSources: ant rebuilds class file again?
Posted by Jhair Tocancipa Triana <jh...@gmx.net>.
"Dominique Devienne" <dd...@gmail.com> writes:
> Have a look at the "always recompile" entry in the FAQ. --DD
Yes, that explains the behaviour.
Thanks,
--
--Jhair
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org
Re: ResourceUtils.selectOutOfDateSources: ant rebuilds class file again?
Posted by Dominique Devienne <dd...@gmail.com>.
> I can reproduce my problem also with a stable version of ant
> (1.6.4). So I suspect there is something terrible wrong in my
> build.xml file or I missed some important point in the documentation.
That may be...
> Any other ideas what could be wrong?
Have a look at the "always recompile" entry in the FAQ. --DD
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org
Re: ResourceUtils.selectOutOfDateSources: ant rebuilds class file again?
Posted by Jhair Tocancipa Triana <jh...@gmx.net>.
Jeffrey E Care <ca...@us.ibm.com> writes:
> AFAIK you would normally use SourceFileScanner to find source files
> that are out of date relative to their destination files.
SourceFileScanner is called indeed. Here is the backtrace after the
breakpoint is hit:
main[1] where
[1] org.apache.tools.ant.util.ResourceUtils.selectOutOfDateSources (ResourceUtils.java:153)
[2] org.apache.tools.ant.util.ResourceUtils.selectOutOfDateSources (ResourceUtils.java:123)
[3] org.apache.tools.ant.util.SourceFileScanner.restrict (SourceFileScanner.java:100)
[4] org.apache.tools.ant.util.SourceFileScanner.restrictAsFiles (SourceFileScanner.java:146)
[5] org.apache.tools.ant.util.SourceFileScanner.restrictAsFiles (SourceFileScanner.java:124)
[6] org.apache.tools.ant.taskdefs.Javac.scanDir (Javac.java:841)
[7] org.apache.tools.ant.taskdefs.Javac.execute (Javac.java:815)
[8] org.apache.tools.ant.UnknownElement.execute (UnknownElement.java:275)
[9] sun.reflect.NativeMethodAccessorImpl.invoke0 (native method)
[10] sun.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:39)
[11] sun.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:25)
[12] java.lang.reflect.Method.invoke (Method.java:585)
[13] org.apache.tools.ant.dispatch.DispatchUtils.execute (DispatchUtils.java:104)
[14] org.apache.tools.ant.Task.perform (Task.java:375)
[15] org.apache.tools.ant.Target.execute (Target.java:356)
[16] org.apache.tools.ant.Target.performTasks (Target.java:384)
[17] org.apache.tools.ant.Project.executeSortedTargets (Project.java:1,268)
[18] org.apache.tools.ant.Project.executeTarget (Project.java:1,237)
[19] org.apache.tools.ant.helper.DefaultExecutor.executeTargets (DefaultExecutor.java:40)
[20] org.apache.tools.ant.Project.executeTargets (Project.java:1,120)
[21] org.apache.tools.ant.Main.runBuild (Main.java:686)
[22] org.apache.tools.ant.Main.startAnt (Main.java:196)
[23] org.apache.tools.ant.launch.Launcher.run (Launcher.java:279)
[24] org.apache.tools.ant.launch.Launcher.main (Launcher.java:100)
I can reproduce my problem also with a stable version of ant
(1.6.4). So I suspect there is something terrible wrong in my
build.xml file or I missed some important point in the documentation.
Any other ideas what could be wrong?
Thanks,
--
--Jhair
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org
Re: ResourceUtils.selectOutOfDateSources: ant rebuilds class file again?
Posted by Jeffrey E Care <ca...@us.ibm.com>.
AFAIK you would normally use SourceFileScanner to find source files that
are out of date relative to their destination files.
____________________________________________________________________________________________
Jeffrey E. (Jeff) Care
carej@us.ibm.com
IBM WebSphere Application Server Development
WAS Pyxis Lead Release Engineer
news <ne...@sea.gmane.org> wrote on 06/28/2006 10:38:17 AM:
> [My apologies if this question is more appropiate for the users
> list. I tested the following with sources from the SVN repository].
>
> Please consider the test case below:
>
> http://people.freenet.de/jtocancipa/ant_test_case.tgz
>
> $ tar tvzf ant_test_case.tgz
> -rw-r--r-- user/users 257 2006-06-28 15:25:01 build.xml
> drwxr-xr-x user/users 0 2006-06-28 15:40:48 src/com/
> drwxr-xr-x user/users 0 2006-06-28 15:40:56 src/com/icon/
> drwxr-xr-x user/users 0 2006-06-28 15:37:07 src/com/icon/common/
> -rw-r--r-- user/users 149 2006-06-28 15:35:42
src/com/icon/common/TestAnt.java
>
> When I run ant over this dummy example more than once, the
> classes/com/icon/common/TestAnt.class is generated everytime again --
> it shouldn't if the TestAnt.java file hasn't been modified.
>
> ant -verbose says the following:
>
> compile:
> [javac] TestAnt.java added as TestAnt.class doesn't exist.
>
> The file classes/com/icon/common/TestAnt.class exists though.
>
> I don't know much about ant internals, but I am interested to
> learn. So I tried to debug this to see why this was happening. I set a
> breakpoint in org.apache.tools.ant.util.ResourceUtils:174.
>
> main[1] print granularity
> granularity = 1000
> main[1] print sr
> sr = "TestAnt.java"
> main[1] print r
> r = "<directory>/classes/TestAnt.class"
>
> Since <directory>/classes/TestAnt.class does not exist, the
> TestAnt.java file is compiled again.
>
> On the other hand the file
>
> <directory>/classes/com/icon/common/Test.class
>
> *does* exist.
>
> Why does ant look for the .class file in the "wrong" directory
> (i.e. classes instead classes/com/icon/common)?
>
> Thanks in advance for your help,
>
> --
> --Jhair
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
> For additional commands, e-mail: dev-help@ant.apache.org
>