简体   繁体   English

如何解决ANT“ exec”命令行错误消息?

[英]How do I troubleshoot an ANT “exec” command line error message?

Using an Ant script, I am trying to build the bar file to deploy in IIB Server. 我正在尝试使用Ant脚本来构建要在IIB Server中部署的bar文件。 But I am facing an error like: 但是我遇到了类似的错误:

BIP0960E Incorrect "-a", "-l", "-p", or "-o" argument supplied to mqsicreatebar BIP0960E提供给mqsicreatebar的参数“ -a”,“-l”,“-p”或“ -o”不正确

Please do let me know how to solve this error. 请让我知道如何解决此错误。

Thank You. 谢谢。

I am using the following ant script : 我正在使用以下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>

I placed all the necessary components to build the bar file. 我放置了所有必要的组件来构建bar文件。

The BIP0960 error message above indicates you have passed the incorrect parameters to the executable you are running in your script. 上面的BIP0960错误消息表明您已将错误的参数传递给了在脚本中运行的可执行文件。 You need to troubleshoot the parameter string you are passing to your executable. 您需要对传递给可执行文件的参数字符串进行故障排除。

It can be hard to debug ANT exec statements in the way that you have structured them. 以您构造它们的方式来调试ANT exec语句可能很难。

A good technique for debugging ANT scripts is to create a single property for the command line parameter string, and then echo those parameters to the console to confirm their construction. 调试ANT脚本的一种好方法是为命令行参数字符串创建单个属性,然后将这些参数回显到控制台以确认其构造。 Use this parameter string output to review, test, modify and re-run the command and its parameters, until they work. 使用此参数字符串输出来检查,测试,修改和重新运行命令及其参数,直到它们起作用为止。

To do this, refactor your exec statement so it references the single parameter string, called ${myParams}: 为此,请重构您的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> 

The echo statement will show you the property variables expanded. echo语句将向您显示扩展的属性变量。 Copy and paste this to the command line, and try again. 将其复制并粘贴到命令行,然后重试。 When you have the right parameters, copy and paste that back into your script, replacing static values with the correct variables. 使用正确的参数后,将其复制并粘贴回脚本中,用正确的变量替换静态值。

Likewise it is easier to manage changes to the command line as one property, instead of multiple arg values. 同样,更容易将命令行更改作为一个属性而不是多个arg值进行管理。

Use this construction, and you can easily troubleshot any exec command problems. 使用此构造,您可以轻松解决任何exec命令问题。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM