使用ANT将文件从本地目录复制到映射的驱动器

时间:2015-04-02 16:55:58

标签: ant jenkins

我想使用ANT将文件从本地计算机移动到映射驱动器。我使用net use命令将我的Z驱动器映射到下面的位置

  • // IP地址/ C $ / ShareFolder
  • net use Z:/ persistent:yes // IP Address / C $ / ShareFolder

我首先尝试让Z驱动器成为我的最佳选择。

<copy todir="Z:/Results/">
  <fileset dir="${LocalResults}">
    <include name="**/*"/>
  </fileset>
</copy>

以下是Jenkins的输出

[copy] Copying 16 files to Z:\Results
Attempt to copy C:\Program Files\results\index.html to Z:\Results\index.html using NIO Channels failed due to 'failed to create the parent directory for Z:\Results\index.html'.  Falling back to streams.

BUILD FAILED
C:\Deploy\copyResults.xml:69: Failed to copy C:\Program Files\results\index.html to Z:\Results\index.html due to java.io.FileNotFoundException Z:\Results\index.html(The system cannot find the path specified)

如果我使用的是位置而不是映射的驱动器,它将起作用。

<copy todir="//IP Address/C$/ShareFolder/Results/">
  <fileset dir="${LocalResults}">
    <include name="**/*"/>
  </fileset>
</copy>

是否有理由在todir中使用映射驱动器不起作用?

1 个答案:

答案 0 :(得分:0)

快速启动问题,Jenkins是在带有服务的Windows服务器上运行的吗?

在这种情况下,我认为您无法使用映射驱动器(由于服务帐户)。

使用文件夹网址最好:\\ MY_IP \ share \ drive

相关问题