tags:

views:

74

answers:

3

I want my ant script to execute the command

java -cp libs/a.jar:libs/b.jar org.stack.class1 --package pName --out classes new.wsdl

How can I do it with an Ant script? The following does not work

<?xml version="1.0" encoding="UTF-8"?>
<project name="class" default="compile">
<target name="compile">
    <java classname="org.stack.class1" fork="true">
    <classpath>
        <pathelement location="libs/a.jar"/>
        <pathelement location="libs/b.jar"/>

    </classpath>
    <arg value="--package pName --out classes new.wsdl"/>

    </java>
</target>

It complains that --package pName --out classes new.wsdl is an argument for java. However I want --package pName --out classes new.wsdl to be arguments to org.stack.class1

+1  A: 

For the java task, the <arg> elements take a single token each. Try something like this

<arg value="--package"/>
<arg value="pName"/>
<arg value="--out"/>
... etc
karoberts
A: 

I think the issue is with your arg value. According to the documentation here, you are not specifying two separate command line arguments with

<arg value="--package pName --out classes new.wsdl"/>

I would try changing it to

<arg line="--package pName --out classes new.wsdl"/>
Casey
did the job. ;-p
cateof
That has gotten me in the past as well.
Casey
A: 

The value parameter of the arg tag can only take one parameter. See the documentation of the arg tag.

Try adding several arg tags, one for each parameter.

Peter Jaric