Reputation: 883
What is the common usage of using ant to execute a java class or method.
I have multiple methods within on class that I need to call if ant run or restore are run. Both run and restore are methods of the same java class but, I cannot seem to get ant run to execute Class.beginExecution() and ant restore to execute Class.beginRestore()..
Thanks
Upvotes: 2
Views: 12804
Reputation: 54015
Are you looking for the Java task? You need to give it a fully qualified name of a class with a main method, just as if you ran it from command line.
Upvotes: 5
Reputation: 91881
You have a few options:
Upvotes: 2
Reputation: 253
You need to write regular java class with main method and run it with the following ant task:
<target name="run_main" depends="dist" description="--> runs main method of class YourMainClass">
<java classname="test.com.YourMainClass"
failonerror="true"
fork="true">
<sysproperty key="DEBUG" value="true"/>
<arg value="${basedir}/"/>
<classpath>
<pathelement location="all.project.class.path"/>
</classpath>
</java>
</target>
Upvotes: 0