SBT equivalent of Ant targets?

29 views
Skip to first unread message

adelbertc

unread,
Oct 10, 2012, 7:44:55 PM10/10/12
to simple-b...@googlegroups.com
What is the SBT equivalent (if any) of Ant targets? For example, a snippet in a build.xml file for Ant would be:

<target name="runClient" description="run client">
<java classname="client.Client" fork="true">
<jvmarg value="-Djava.rmi.server.codebase=${client_web_codebase}"/>
<jvmarg value="-Djava.security.policy=policy"/>
<arg value="localhost"/>
<classpath>
<pathelement location="dist/client.jar"/>
</classpath>
</java>
</target>

And then I would do something like "ant runClient" to launch the application "client.Client" with the jvmargs specified in the XML.. is there an SBT equivalent, or a way for SBT to hook into Ant to do this?

Thanks!

Alexey Lunacharsky

unread,
Oct 11, 2012, 1:23:49 AM10/11/12
to simple-b...@googlegroups.com
I believe you should consider tasks - http://www.scala-sbt.org/release/docs/Detailed-Topics/Tasks.html

They can depend on settings and other tasks as well as ANT's targets do.

But here you can use any JVM compatible language to implement it instead of an XML.

After all in SBT task key can be implemented differently per every particular config (e.g. for compile or for test)

That rocks!

четверг, 11 октября 2012 г., 6:44:55 UTC+7 пользователь adelbertc написал:

adelbertc

unread,
Oct 11, 2012, 12:30:36 PM10/11/12
to simple-b...@googlegroups.com
Hi Alaxey,

Thanks for the reply - SBT Tasks certainly looks interesting and seems they could solve my problem.. one question - which SBT object/class do I use to run a particular class, and is it possible to limit the classpath during that run? i.e. if i have A B C and D classes in my project, I want to run the main method in object A, but only have B and C on the classpath. If so, how?

Thanks!
Reply all
Reply to author
Forward
0 new messages