【问题标题】:Use ANT to copy files from local directory to a mapped drive使用 ANT 将文件从本地目录复制到映射驱动器
【发布时间】:2015-06-07 17:27:09
【问题描述】:

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

  • //IP地址/C$/ShareFolder
  • net use Z: /persistent:yes //IP地址/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 中使用映射驱动器不起作用?

【问题讨论】:

标签: ant jenkins


【解决方案1】:

快速开始提问,Jenkins 正在带有服务的 Windows 服务器上运行?

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

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

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2016-12-28
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-12-21
    • 1970-01-01
    相关资源
    最近更新 更多