Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/ant/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
macrodef for java jar中的可选sysproperty_Java_Ant - Fatal编程技术网

macrodef for java jar中的可选sysproperty

macrodef for java jar中的可选sysproperty,java,ant,Java,Ant,我尝试编译一个项目: 但是,当我尝试使用ant对cpp98的目标进行编译时,编译失败。经过大量分析后,它失败了,因为build.xml中的某个宏在启动jar时试图拥有可选的sysproperty,但没有做到这一点 下面是一个正在工作的build.xml,它是项目失败原因的摘录(但需要几个文件才能启动): ),其中一些属性不应使用,尤其是: sbe.target.namespace: Namespace to be used for generated code. Equates package

我尝试编译一个项目: 但是,当我尝试使用ant对cpp98的目标进行编译时,编译失败。经过大量分析后,它失败了,因为build.xml中的某个宏在启动jar时试图拥有可选的sysproperty,但没有做到这一点

下面是一个正在工作的build.xml,它是项目失败原因的摘录(但需要几个文件才能启动):


),其中一些属性不应使用,尤其是:

sbe.target.namespace: Namespace to be used for generated code. Equates package for Java. If not provided then the package attribute from the schema will be used.
总而言之,我的问题是有没有办法让这些系统属性在这个宏中实际上是可选的?这不是我的项目,我对ant一无所知,因此如果您能帮助我,我将不胜感激。:)

看到了吗?这是由宏定义中的
定义的,而不是
。没有理由不以同样的方式定义系统属性

当然,您也必须更改对宏的调用。这意味着,如果有人想设置系统属性,如果他们想设置,就必须在宏调用中放入这些
行。假设宏定义为:

<macrodef name="sbetool">
    <element name="sysproperties"/>
    <element name="schemafiles"/>    <!-- Note "implicit" has been removed-->
<macrodef name="sbetool">
    <element name="sysproperties"/>
    <element name="schemafiles"/>    <!-- Note "implicit" has been removed-->
<sbetool>
    <sysproperties>
         <sysproperty key="sbe.output.dir" value="..."/>
         <sysproperty key="sbe.target.language" value="..."/> 
         <sysproperty key="sbe.target.namespace" value="..."/>
    <sysproperties/>
     <schemafiles>
         <arg value="sbe-test.xml"/>
     <schemafiles/>
</sbetool>
<fail message="Must set &quot;outputdir&quot; and &quot;validationxsd&quot.">
    <condition>
        <or>
            <equals arg1="@{outputdir}" arg2=""/>
            <equals arg1="@{validationxml}" arg2=""/>
        </or>
    </condition>
</fail>