You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by Dharmesh Vyas <dh...@gmail.com> on 2006/12/15 09:46:33 UTC

[Copying of a file] Issue

Hello Group,

I am trying to call one target from another and while calling the other
target I am passing a parameter value which is to be used in the called
target. Here it is what I am doing.

 <target name="one" description="debug binaries">
  <antcall target="copylogs">
   <param name="logs" value="debuglogs.txt"/>
  </antcall>
 </target>

<target name="copylogs" description="copying the logs for the failures">
   <copy file="${basedir}\logs\${logs}"
tofile="${basedir}\filestobesent\${logs}"/>
 </target>

After running the target it the copying of the file happens successfully but
it thows an error as shown below.
*ERROR:*

ANT_HOME is set to = C:\Pooja\MyView\ATG_FIX\eprods\java\apache-ant-1.6.3
Build sequence for target(s) `scanlogs' is [scanlogs]
Complete build sequence is [scanlogs, fixprovider_d, debug, fixprovider_r,
creat
elogsdir, checkcondition, loadfiletoproperty, cdatetime, sendmail, release,
all,
 temp, ]
Entering C:\Pooja\MyView\ATG_FIX\base\ATG\FIX\ATG
FIX\build\MyBuildTestEnv.xml..
.
Build sequence for target(s) `scanlogs' is [scanlogs]
Complete build sequence is [scanlogs, fixprovider_d, debug, fixprovider_r,
creat
elogsdir, checkcondition, loadfiletoproperty, cdatetime, sendmail, release,
all,
 temp, ]

scanlogs:
Copying 1 file to C:\Pooja\MyView\ATG_FIX\base\ATG\FIX\ATG
FIX\build\filestobese
nt
Copying C:\Pooja\MyView\ATG_FIX\base\ATG\FIX\ATG
FIX\build\logs\fixproviderdebug
logs.txt to C:\Pooja\MyView\ATG_FIX\base\ATG\FIX\ATG
FIX\build\filestobesent\fix
providerdebuglogs.txt
Exiting C:\Pooja\MyView\ATG_FIX\base\ATG\FIX\ATG
FIX\build\MyBuildTestEnv.xml.

debug:

scanlogs:
Property ${logs} has not been set
Property ${logs} has not been set

BUILD FAILED
C:\Pooja\MyView\ATG_FIX\base\ATG\FIX\ATG FIX\build\MyBuildTestEnv.xml:94:
Warnin
g: Could not find file C:\Pooja\MyView\ATG_FIX\base\ATG\FIX\ATG
FIX\build\logs\$
{logs} to copy.
        at org.apache.tools.ant.taskdefs.Copy.execute(Copy.java:394)
        at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java
:275)
        at org.apache.tools.ant.Task.perform(Task.java:364)
        at org.apache.tools.ant.Target.execute(Target.java:341)
        at org.apache.tools.ant.Target.performTasks(Target.java:369)
        at org.apache.tools.ant.Project.executeSortedTargets(Project.java
:1216)
        at org.apache.tools.ant.Project.executeTarget(Project.java:1185)
        at org.apache.tools.ant.helper.DefaultExecutor.executeTargets
(DefaultExe
cutor.java:40)
        at org.apache.tools.ant.Project.executeTargets(Project.java:1068)
        at org.apache.tools.ant.Main.runBuild(Main.java:668)
        at org.apache.tools.ant.Main.startAnt(Main.java:187)
        at org.apache.tools.ant.launch.Launcher.run(Launcher.java:246)
        at org.apache.tools.ant.launch.Launcher.main(Launcher.java:67)

Total time: 1 second



Please let me know If I am missing something over here.

Thanks in advance,

- Dharmesh Vyas.

Re: [Copying of a file] Issue

Posted by Dharmesh Vyas <dh...@gmail.com>.
(1)
Thanks for your reply Andrew.

I changed the name from "scanlogs" to "copylogs" by while sending the mail.
The problem at line 94 is with the line highlighted. I don't understand why
it's showing the error for ${logs},  where in actually the copying part
works successfully. It copies the file from the correct location to the
desired location. But shows this error.
The original one looks like
<target name="scanlogs" description="copying the logs for the failures">
   <copy file="${basedir}\logs\${logs}"
tofile="${basedir}\filestobesent\${logs}"/>
 </target>

I am still unable to find the cause of the problem.

(2)
Another thing is, I am using ant-contrib for some of the tasks.
For each task I need declare the classpath and add this taskdef line in my
script. For e.g
 <taskdef name="for" classname="net.sf.antcontrib.logic.ForTask" />
 <taskdef name="if" classname="net.sf.antcontrib.logic.IfTask" />

Is there any other work around?

Thanks in advance,
- Dharmesh.

On 12/15/06, Andrew Goktepe <an...@gmail.com> wrote:
>
> In your Ant output, I don't see any calls to the targets you provided. It
> looks like your error is occuring in some other target (maybe scanlogs).
>
> Go to line 94 in your script to see if you're looking at the right target.
>
> -Andrew
>
> On 12/15/06, Dharmesh Vyas <dh...@gmail.com> wrote:
> >
> > Hello Group,
> >
> > I am trying to call one target from another and while calling the other
> > target I am passing a parameter value which is to be used in the called
> > target. Here it is what I am doing.
> >
> > <target name="one" description="debug binaries">
> > <antcall target="copylogs">
> >   <param name="logs" value="debuglogs.txt"/>
> > </antcall>
> > </target>
> >
> > <target name="copylogs" description="copying the logs for the failures">
> >   <copy file="${basedir}\logs\${logs}"
> > tofile="${basedir}\filestobesent\${logs}"/>
> > </target>
> >
> > After running the target it the copying of the file happens successfully
> > but
> > it thows an error as shown below.
> > *ERROR:*
> >
> > ANT_HOME is set to = C:\Pooja\MyView\ATG_FIX\eprods\java\apache-
> ant-1.6.3
> > Build sequence for target(s) `scanlogs' is [scanlogs]
> > Complete build sequence is [scanlogs, fixprovider_d, debug,
> fixprovider_r,
> > creat
> > elogsdir, checkcondition, loadfiletoproperty, cdatetime, sendmail,
> > release,
> > all,
> > temp, ]
> > Entering C:\Pooja\MyView\ATG_FIX\base\ATG\FIX\ATG
> > FIX\build\MyBuildTestEnv.xml..
> > .
> > Build sequence for target(s) `scanlogs' is [scanlogs]
> > Complete build sequence is [scanlogs, fixprovider_d, debug,
> fixprovider_r,
> > creat
> > elogsdir, checkcondition, loadfiletoproperty, cdatetime, sendmail,
> > release,
> > all,
> > temp, ]
> >
> > scanlogs:
> > Copying 1 file to C:\Pooja\MyView\ATG_FIX\base\ATG\FIX\ATG
> > FIX\build\filestobese
> > nt
> > Copying C:\Pooja\MyView\ATG_FIX\base\ATG\FIX\ATG
> > FIX\build\logs\fixproviderdebug
> > logs.txt to C:\Pooja\MyView\ATG_FIX\base\ATG\FIX\ATG
> > FIX\build\filestobesent\fix
> > providerdebuglogs.txt
> > Exiting C:\Pooja\MyView\ATG_FIX\base\ATG\FIX\ATG
> > FIX\build\MyBuildTestEnv.xml.
> >
> > debug:
> >
> > scanlogs:
> > Property ${logs} has not been set
> > Property ${logs} has not been set
> >
> > BUILD FAILED
> > C:\Pooja\MyView\ATG_FIX\base\ATG\FIX\ATG
> FIX\build\MyBuildTestEnv.xml:94:
> > Warnin
> > g: Could not find file C:\Pooja\MyView\ATG_FIX\base\ATG\FIX\ATG
> > FIX\build\logs\$
> > {logs} to copy.
> >        at org.apache.tools.ant.taskdefs.Copy.execute(Copy.java:394)
> >        at org.apache.tools.ant.UnknownElement.execute(
> UnknownElement.java
> > :275)
> >        at org.apache.tools.ant.Task.perform(Task.java:364)
> >        at org.apache.tools.ant.Target.execute(Target.java:341)
> >        at org.apache.tools.ant.Target.performTasks(Target.java:369)
> >        at org.apache.tools.ant.Project.executeSortedTargets(Project.java
> > :1216)
> >        at org.apache.tools.ant.Project.executeTarget(Project.java:1185)
> >        at org.apache.tools.ant.helper.DefaultExecutor.executeTargets
> > (DefaultExe
> > cutor.java:40)
> >        at org.apache.tools.ant.Project.executeTargets(Project.java:1068)
> >        at org.apache.tools.ant.Main.runBuild(Main.java:668)
> >        at org.apache.tools.ant.Main.startAnt(Main.java:187)
> >        at org.apache.tools.ant.launch.Launcher.run(Launcher.java:246)
> >        at org.apache.tools.ant.launch.Launcher.main(Launcher.java:67)
> >
> > Total time: 1 second
> >
> >
> >
> > Please let me know If I am missing something over here.
> >
> > Thanks in advance,
> >
> > - Dharmesh Vyas.
> >
> >
>
>

Re: [Copying of a file] Issue

Posted by Andrew Goktepe <an...@gmail.com>.
In your Ant output, I don't see any calls to the targets you provided. It
looks like your error is occuring in some other target (maybe scanlogs).

Go to line 94 in your script to see if you're looking at the right target.

-Andrew

On 12/15/06, Dharmesh Vyas <dh...@gmail.com> wrote:
>
> Hello Group,
>
> I am trying to call one target from another and while calling the other
> target I am passing a parameter value which is to be used in the called
> target. Here it is what I am doing.
>
> <target name="one" description="debug binaries">
> <antcall target="copylogs">
>   <param name="logs" value="debuglogs.txt"/>
> </antcall>
> </target>
>
> <target name="copylogs" description="copying the logs for the failures">
>   <copy file="${basedir}\logs\${logs}"
> tofile="${basedir}\filestobesent\${logs}"/>
> </target>
>
> After running the target it the copying of the file happens successfully
> but
> it thows an error as shown below.
> *ERROR:*
>
> ANT_HOME is set to = C:\Pooja\MyView\ATG_FIX\eprods\java\apache-ant-1.6.3
> Build sequence for target(s) `scanlogs' is [scanlogs]
> Complete build sequence is [scanlogs, fixprovider_d, debug, fixprovider_r,
> creat
> elogsdir, checkcondition, loadfiletoproperty, cdatetime, sendmail,
> release,
> all,
> temp, ]
> Entering C:\Pooja\MyView\ATG_FIX\base\ATG\FIX\ATG
> FIX\build\MyBuildTestEnv.xml..
> .
> Build sequence for target(s) `scanlogs' is [scanlogs]
> Complete build sequence is [scanlogs, fixprovider_d, debug, fixprovider_r,
> creat
> elogsdir, checkcondition, loadfiletoproperty, cdatetime, sendmail,
> release,
> all,
> temp, ]
>
> scanlogs:
> Copying 1 file to C:\Pooja\MyView\ATG_FIX\base\ATG\FIX\ATG
> FIX\build\filestobese
> nt
> Copying C:\Pooja\MyView\ATG_FIX\base\ATG\FIX\ATG
> FIX\build\logs\fixproviderdebug
> logs.txt to C:\Pooja\MyView\ATG_FIX\base\ATG\FIX\ATG
> FIX\build\filestobesent\fix
> providerdebuglogs.txt
> Exiting C:\Pooja\MyView\ATG_FIX\base\ATG\FIX\ATG
> FIX\build\MyBuildTestEnv.xml.
>
> debug:
>
> scanlogs:
> Property ${logs} has not been set
> Property ${logs} has not been set
>
> BUILD FAILED
> C:\Pooja\MyView\ATG_FIX\base\ATG\FIX\ATG FIX\build\MyBuildTestEnv.xml:94:
> Warnin
> g: Could not find file C:\Pooja\MyView\ATG_FIX\base\ATG\FIX\ATG
> FIX\build\logs\$
> {logs} to copy.
>        at org.apache.tools.ant.taskdefs.Copy.execute(Copy.java:394)
>        at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java
> :275)
>        at org.apache.tools.ant.Task.perform(Task.java:364)
>        at org.apache.tools.ant.Target.execute(Target.java:341)
>        at org.apache.tools.ant.Target.performTasks(Target.java:369)
>        at org.apache.tools.ant.Project.executeSortedTargets(Project.java
> :1216)
>        at org.apache.tools.ant.Project.executeTarget(Project.java:1185)
>        at org.apache.tools.ant.helper.DefaultExecutor.executeTargets
> (DefaultExe
> cutor.java:40)
>        at org.apache.tools.ant.Project.executeTargets(Project.java:1068)
>        at org.apache.tools.ant.Main.runBuild(Main.java:668)
>        at org.apache.tools.ant.Main.startAnt(Main.java:187)
>        at org.apache.tools.ant.launch.Launcher.run(Launcher.java:246)
>        at org.apache.tools.ant.launch.Launcher.main(Launcher.java:67)
>
> Total time: 1 second
>
>
>
> Please let me know If I am missing something over here.
>
> Thanks in advance,
>
> - Dharmesh Vyas.
>
>