2013-10-22 174 views
3

我使用Silk4J,在我的构建中,我必须启动代理。我使用的命令是:Ant执行命令

<exec spawn="true" executable="${env.OPEN_AGENT_HOME}/agent/openAgent.exe" /> 

它给了我这个错误

The ' characters around the executable and arguments are not part of the command. 

我是否需要改变呢?

回答

4

该消息不表示错误。

-v-verbose-d,或-debug选项分配给蚂蚁,所述<exec>任务输出其沿着与所述消息执行命令:

[exec] Current OS is Windows 7 
[exec] Executing 'cmd' with arguments: 
[exec] '/c' 
[exec] '@for %a in (C:\src\ant\ant-dir-file-local) do @echo %~ta' 
[exec] 
[exec] The ' characters around the executable and arguments are 
[exec] not part of the command. 
[exec] 10/23/2013 02:36 AM 

打破上述的例子...

[exec] Executing 'cmd' with arguments: 
       ^^
[exec] '/c' 
     ^^ 
[exec] '@for %a in (C:\src\ant\ant-dir-file-local) do @echo %~ta' 
     ^             ^

在这种情况下,每个^上方的单引号(')不是该命令的一部分。 Ant使用单引号将可执行文件名称和每个参数封装起来,以清楚说明命令的组成部分,以及哪些不是。 Ant可以帮助用户在<exec>不符合预期行为时调试Ant脚本。该信息纯粹是信息性的。

+0

好的,但为什么我得到这个错误:'可执行文件和参数周围的字符不是命令的一部分。而构建完成而不执行测试运行?!?在OpenAgent之后,它假设执行此操作: –

+0

/target> –

+1

同样,这是一条信息性消息,不是错误。要理解测试未运行的原因,请使用完整的Ant脚本创建一个新问题,以及在使用“-verbose”选项运行Ant时从Ant获得的输出。 –

2

这是很好的做法,包在单引号中记录的条目,使条目是否是空的,你仍然可以看到它,例如:

没有密码的用户'

否则你会看到:

没有密码的用户

这是误导。 在这种情况下,它只会通知您,报价仅出于此原因而不是记录数据的一部分。我认为这句话有点令人困惑,因为消极形式'不是命令的一部分',看起来像是有问题...

0

这是纯粹的信息。它表明上面看到的撇号(')符号实际上并不在已经使用的命令中。 它只是“引用”您在命令中使用的字符串标记。

实施例:

[exec] Current OS is Windows 10 
[exec] Output redirected to property: git.timestamp 
[exec] Executing 'cmd.exe' with arguments: 
[exec] '/c' 
[exec] 'git' 
[exec] 'show' 
[exec] '-s' 
[exec] '--format=%ct' 
[exec] 
[exec] The ' characters around the executable and arguments are 
[exec] not part of the command. 

这表明您使用/C GIT中显示-s --format =%克拉内部CMD,可以看到,从'/ C''git'令牌。它只是告诉你忽略'符号。它实际使用的是链中的git,show,-ss等标记,形成一个完整的命令。