cateof
cateof

Reputation: 797

execute java class with ant

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

Upvotes: 2

Views: 1435

Answers (3)

Peter Jaric
Peter Jaric

Reputation: 5302

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.

Upvotes: 0

user147373
user147373

Reputation:

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"/>

Upvotes: 1

karoberts
karoberts

Reputation: 9938

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

Upvotes: 1

Related Questions