Java – how to pass a variable number of parameters to ant Exec
                                        
                    •
                    Java                                    
                I have an ant target that accepts some variable parameters that can be passed to the exec task Using the old mechanism, it is trivial:
<exec command="cmd /c ${_full-path-to-exec}" osfamily="windows" failonerror="true">
</exec>
However, it is not recommended to use 'command' to support nested elements like this:
<exec executable="cmd" osfamily="windows" failonerror="true">
    <arg value="/c"/>
    <arg file="${_full-path-to-exec}"/>
    <arg value="${_param-one}"/>
    <arg value="${_param-two}"/>
    <arg value="${_param-three}"/>
</exec>
This makes the variable argument list impossible
How to solve this problem?
Solution
How's this?
<arg line="whatever args you need"/>
                            The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
                        
                                            
                        THE END
                    
                    
                    
                                                        二维码
                        
                        
                                                
                        