使用 Ant 脚本,我尝试构建要在 IIB 服务器中部署的 bar 文件。但我面临这样的错误:
BIP0960E Incorrect "-a", "-l", "-p", or "-o" argument supplied to mqsicreatebar
请告诉我如何解决此错误。
谢谢。
我正在使用以下 ant 脚本:
<?xml version="1.0" encoding="UTF-8"?>
<project name="Test" default="Create_bar" basedir=".">
<property file="ucd.properties"></property>
<taskdef resource="net/sf/antcontrib/antlib.xml">
<classpath>
<pathelement location="C:\apache-ant-1.9.6\lib\antcontrib.jar"/>
</classpath>
</taskdef>
<!-- Making Windows command environment -->
<target name="mqsiprofile.cmd">
<exec executable="${broker.mqsi.path}\mqsiprofile.cmd" />
</target>
// <!-- Creating a bar file -->
<target name="Create_bar">
<for list="${project_name}" delimiter="," param="pName">
<sequential>
<echo message="@{pName}"/>
<exec executable="${toolkit.home}\mqsicreatebar.exe" spawn="false" vmlauncher="false" failonerror="true">
// <!-- project's workspace-->
<arg value="-data" />
<arg value="${workspaces.dir}" />
<!--barfile generated path-->
<arg value="-b" />
<arg value="${bar.loc}\@{pName}.msgflow.generated.bar" />
<!--project Name-->
<arg value="-p" />
<arg value="@{pName}" />
<!--Message flows for its corresponding projects which has given in cvsCheckout.properties-->
<arg value="-o" />
<arg line="@{bar.loc}\${@{pName}.flow_name}" />
<arg line="@{bar.loc}\IAM_Demo_Compute.esql" />
<arg value="-deployAsSource" />
</exec>
</sequential>
</for>
</target>
</project>
我放置了构建 bar 文件所需的所有组件。
最佳答案
上面的 BIP0960
错误消息表明您向脚本中运行的可执行文件传递了不正确的参数。您需要对传递给可执行文件的参数字符串进行故障排除。
按照您构建的方式调试 ANT exec
语句可能很困难。
调试 ANT 脚本的一个好技术是为命令行参数字符串创建单个属性,然后将这些参数回显到控制台以确认其构造。使用此参数字符串输出来检查、测试、修改和重新运行命令及其参数,直到它们起作用。
为此,请重构 exec
语句,使其引用名为 ${myParams} 的单个参数字符串:
<!-- create the command parameters -->
<property name="myParams" value="-data ${workspaces.dir} -b ${bar.loc}\@{pName}.msgflow.generated.bar -p @{pName -o @{bar.loc}\${@{pName}.flow_name} @{bar.loc}\IAM_Demo_Compute.esql -deployAsSource" />
<!-- echo myParams -->
<echo message="myParams: ${myParams}" />
<!-- pass myParams to the executable -->
<exec executable="${toolkit.home}\mqsicreatebar.exe" spawn="false" vmlauncher="false" failonerror="true">
<arg line="${myParams}" />
</exec>
echo
语句将显示展开的属性变量。将其复制并粘贴到命令行,然后重试。当您拥有正确的参数时,将其复制并粘贴回脚本中,用正确的变量替换静态值。
同样,将命令行更改作为一个属性来管理比多个 arg
值更容易。
使用这种结构,您可以轻松解决任何 exec 命令问题。
关于java - 如何排除 ANT "exec"命令行错误消息?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35230759/