I have some files on a Unix machine which I can access from my Windows PC with Windows Explorer using \host\directory
However, when using an ant copy task, ant keeps on saying the directory doesn't exist...
So, the ant part is:
<if>
<available file="${unix-dbs-dir}" type="dir" />
<then>
<echo message="${unix-dbs-dir} exists"/>
</then>
<else>
<echo message="${unix-dbs-dir} doesn't exist"/>
</else>
</if>
<copy todir="${dbsDir}" verbose="true">
<fileset dir="${unix-dbs-dir}">
<include name="*.bd"/>
</fileset>
</copy>
The output of this is:
15:28:42 [echo] \\hyperion\dbs doesn't exist
15:28:42
15:28:42 BUILD FAILED
15:28:42 ... \\hyperion\dbs does not exist.
If I try the same with a remote Windows network path, it does work...
Any idea how to fix this? Seems strange that I can just access \hyperion\dbs with my Windows Explorer, but ant apparently can't...
The Unix is a CentOs 6.5, but I guess that doesn't matter.
Some extra information. I've created a small build.xml script to copy a file from our Unix machine to a Windows machine. If I execute the build.xml ant script from the command line (not started as administrator by the way), then the output is:
C:\Users\lievenc\TestCopyHyperion>%ANT_HOME%/bin/ant.bat -lib lib
Unable to locate tools.jar. Expected to find it in C:\Program Files\Java\jre1.8.
0_45\lib\tools.jar
Buildfile: C:\Users\lievenc\TestCopyHyperion\build.xml
[echo] Load them from directory \\srv-linuxdev\pde\appl\samplenet\dbs
[echo] \\srv-linuxdev\pde\appl\samplenet\dbs exists
[copy] Copying 1 file to C:\Users\lievenc\TestCopyHyperion
[copy] Copying \\srv-linuxdev\pde\appl\samplenet\dbs\apif.d to C:\Users\lievenc\TestCopyHyperion\apif.d
When executing this build.xml script from Jenkins, I get following output:
[workspace] $ cmd.exe /C '"C:\Jenkins\tools\hudson.tasks.Ant_AntInstallation\1.9.4\bin\ant.bat -lib lib && exit %%ERRORLEVEL%%"'
Buildfile: C:\Jenkins\jobs\test-copying-from-hyperion\workspace\build.xml
[echo] Load them from directory \\srv-linuxdev\pde\appl\samplenet\dbs
[echo] \\srv-linuxdev\pde\appl\samplenet\dbs doesn't exist
Can't seem to figure out what the difference is. cmd.exe must be executed as some other user? I'm just guessing here, but from my command line in Windows, I'm executing ant as a Domain User. Maybe this is different from Jenkins?
Ant script:
<?xml version="1.0"?>
<project basedir="." xmlns:ac="antlib:net.sf.antcontrib">
<!-- antcontrib -->
<taskdef resource="net/sf/antcontrib/antcontrib.properties"/>
<echo message="Load them from directory \\srv-linuxdev\pde\appl\samplenet\dbs" />
<if>
<available file="\\srv-linuxdev\pde\appl\samplenet\dbs" type="dir" />
<then>
<echo message="\\srv-linuxdev\pde\appl\samplenet\dbs exists"/>
</then>
<else>
<echo message="\\srv-linuxdev\pde\appl\samplenet\dbs doesn't exist"/>
</else>
</if>
<copy todir="${basedir}" verbose="true">
<fileset dir="\\srv-linuxdev\pde\appl\samplenet\dbs">
<include name="apif.d"/>
</fileset>
</copy>
</project>
//hyperion/dbs
format ? – Sialagogue