copy in ANT throws java.io.FileNotFoundException

2019-08-07 05:06发布

问题:

I am using ANT task Copy to copy a zip file from one share to another

<copy file="\\server_share\nightly\xyz08022012.zip" todir="Z:\output\Nightly"/>

when this gets executed, I am getting the below exception

Failed to copy \server_share\nightly\xyz08022012.zip to Z:\output\Nightly\xyz08022012.zip due to java.io.FileNotFoundException Z:\output\Nightly\xyz08022012.zip (The system cannot find the path specified.)`

When I change the Z:\output\Nightly to C:\temp, the copy works

Z:\ points to a server share which is mounted on the server with different user credentials and the drive is made persistent. This work around is because of the fact that when the build runs, the build user does not have access to the output share

Hence I mapped the server share as a network drive with different credentials (the user who has read/write permission) and made this drive persistent

This is on a Windows 7 machine where the build is running.

I tried doing a copy manually and that worked

I looked into Ant Copy Task: Failed to copy due to java.io.FileNotFoundException but doesn't help me

标签: ant