ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Antoine Levy-Lambert <anto...@gmx.de>
Subject Re: FileNotFound exception and source code
Date Tue, 07 Nov 2006 03:16:52 GMT
O'Shea, Sean wrote:
> Hi all,
>
> I'm using ant 1.6.5 and I'm having some trouble debugging through ANT
> code in my IDE.
>
> I'm trying to call ant through Java using the following code:
>
>         String l_major = getMajorVersion();
>         String l_minor = getMinorVersion();
>         Project l_antProject = new Project();
>         l_antProject.setProperty("comp.ver", l_major);
>         l_antProject.setProperty("comp.int.ver", l_minor);
>         ProjectHelper l_projectHelper = new ProjectHelperImpl();
>         l_antProject.init();
>         File l_buildFile = new File("c:" + File.separator + temp +
> File.separator +
>                 + "tutorial" + File.separator + "build-test.xml");
>         l_projectHelper.parse(l_antProject, l_buildFile);
>         l_antProject.executeTarget("build-testapps");
>
> Ant can find the build-test.xml fine. However, when I try to run the
> build-testapps target I get a FileNotFoundException for a zip file I am
> trying to unzip:
>
> --- Nested Exception ---
> java.io.FileNotFoundException: C:\temp\tutorial\temp\FMR-JIL-2.0_40.zip
> (The system cannot find the file specified)
> 	at java.io.FileInputStream.open(Native Method)
> 	at java.io.FileInputStream.<init>(FileInputStream.java:129)
> 	at
> org.apache.tools.ant.taskdefs.Expand.expandFile(Expand.java:153)
> 	at org.apache.tools.ant.taskdefs.Expand.execute(Expand.java:127)
> 	at org.apache.tools.ant.Task.perform(Task.java:341)
> 	at org.apache.tools.ant.Target.execute(Target.java:309)
> 	at org.apache.tools.ant.Target.performTasks(Target.java:336)
> 	at org.apache.tools.ant.Project.executeTarget(Project.java:1339)
> 	at
> com.fmr.itf.service.TestPreProcessor.rebuild(TestPreProcessor.java:333)
> 	at
> com.fmr.itf.service.TestPreProcessorTest.testRebuild(TestPreProcessorTes
> t.java:182)
> 	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> 	at
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.jav
> a:85)
> 	at
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.jav
> a:58)
> 	at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessor
> Impl.java:60)
> 	at java.lang.reflect.Method.invoke(Method.java:391)
> 	at junit.framework.TestCase.runTest(TestCase.java:154)
> 	at junit.framework.TestCase.runBare(TestCase.java:127)
> 	at junit.framework.TestResult$1.protect(TestResult.java:106)
> 	at junit.framework.TestResult.runProtected(TestResult.java:124)
> 	at junit.framework.TestResult.run(TestResult.java:109)
> 	at junit.framework.TestCase.run(TestCase.java:118)
> 	at junit.framework.TestSuite.runTest(TestSuite.java:208)
> 	at junit.framework.TestSuite.run(TestSuite.java:203)
> 	at
> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTe
> stRunner.java:436)
> 	at
> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRun
> ner.java:311)
> 	at
> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRu
> nner.java:192)
>
> If I navigate to C:\temp\tutorial\temp\, the zip file is there.
>
> When I try to run the build-testapps target directly from ant and not
> using the Java code, it runs fine.
>
> I've tried stepping through the code in my IDE, but it appears that the
> lines do not match up.
>   
You are running a JUnit test case from eclipse. You should check which
version of ant is put in the classpath of junit.
Can it be that Eclipse is putting the version of ant which is packaged
as eclipse plugin on the classpath ?
The fact that the zip file is there but your testcase cannot open it is
strange.
On this link
http://marc.theaimsgroup.com/?l=ant-user&m=105856618614531&w=2 I have
written how I use ant programmatically.
It is similar to what you do, but maybe you can try this variant.
> If anyone could offer some advice on this, I'd really appreciate it
>
> Thanks
>
> Sean
>
>   

Antoine

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


Mime
View raw message