<!DOCTYPE REFENTRY PUBLIC "-//Sun Microsystems//DTD DocBook V3.0-Based SolBook Subset V2.0//EN" [
<!--ArborText, Inc., 1988-1999, v.4002-->
<!ENTITY ERROR-CODES "ERROR CODES">
<!ENTITY Date "22 Dec 2004">
<!ENTITY SectDesc "User Commands">
<!ENTITY Software "J2EE SDK 1.4">
<!ENTITY arch "generic">
<!ENTITY copyright "Copyright (c) 2004, Sun Microsystems, Inc. All Rights Reserved">
<!ENTITY exam-tt "EXAMPLES">
<!ENTITY options-common SYSTEM "options-common.sgm">
<!ENTITY synopsis-common SYSTEM "synopsis-common.sgm">
<!ENTITY metainfo SYSTEM "metainfo.sgm">
<!ENTITY sjsas "Sun Java System Application Server">
<!ENTITY attr-tt "ATTRIBUTES">
<!ENTITY opts-tt "OPTIONS">
<!ENTITY % commonents SYSTEM "smancommon.ent">
%commonents;
<!ENTITY % booktitles SYSTEM "booktitles.ent">
%booktitles;
<!ENTITY Dash "&ndash;">
]>
<?Pub UDT _bookmark _target>
<?Pub EntList brvbar bull cross dash diam diams frac12 frac13 frac14 hellip
 laquo lArr loz mdash nabla ndash para pound rArr raquo sect yen ne>
<?Pub Inc>
<refentry id="asant-1m">
<refmeta><refentrytitle>asant</refentrytitle><manvolnum>1M</manvolnum>&metainfo;
</refmeta>
<refnamediv><indexterm><primary sortas="template">asant &mdash; launches the
Jakarta Ant tool</primary></indexterm><indexterm><primary sortas="Launches the Jakarta tool."><?Pub Caret1>
launches the Jakarta Ant tool &mdash; asant</primary></indexterm><refname>
asant</refname><refpurpose>launches the Jakarta Ant tool</refpurpose></refnamediv>
<refsynopsisdiv><title>&synp-tt;</title>
<cmdsynopsis><command>asant <replaceable>target_list</replaceable></command>
</cmdsynopsis></refsynopsisdiv>
<refsect1><title>&desc-tt;</title>
<para>Use the <command>asant</command> command to automate repetitive development
and deployment tasks. <command>asant</command> is a shell script that invokes
the underlying Ant infrastructure after initializing the environment to pick
up the application server installed targets.</para>
<para>To use Ant as part of the Sun Java System Application Server, verify
that your PATH includes the provided <filename>asant</filename> (UNIX) or <filename>
ant.bat</filename>(Windows) script.</para>
<para>The bundled sample applications use <command>asant</command> extensively;
however, <command>asant</command> can be used in any development or operational
environments.</para>
<para>The build targets are represented in the <filename>build.xml</filename>
files that accompany the sample applications.</para>
<para>To use the Ant tool to compile and reassemble the sample applications,
verify that the <filename>$AS_INSTALL/bin</filename> directory is on your
environment's path. On UNIX, add the <filename>$AS_INSTALL/bin</filename>
directory to your PATH environment variable. On Windows, after installing
the Sun ONE Application Server, set the system path by adding <filename>$AS_INSTALL\bin
</filename> to the user PATH. You can access the PATH system variable from:
Start menu, Settings, Control Panel, System, Advanced, Environment Variables,
User Variables for Administrator, PATH.</para>
<para>The <replaceable>target_list</replaceable> is one or more space separated
tasks as described below.</para>
</refsect1>
<refsect1><title>TARGETS</title>
<variablelist termlength="medium">
<varlistentry><term><command>compile</command></term><listitem><para>compiles
all Java source code.</para>
</listitem></varlistentry>
<varlistentry><term><command>jar</command></term><listitem><para>assembles
the EJB JAR module.</para>
</listitem></varlistentry>
<varlistentry><term><command>war</command></term><listitem><para>assembles
the WAR file in <filename><replaceable>sample_dir</replaceable>/assemble/war
</filename></para>
</listitem></varlistentry>
<varlistentry><term><command>ear</command></term><listitem><para>assembles
the EAR file in <filename><replaceable>sample_dir</replaceable>/assemble/ear
</filename></para>
</listitem></varlistentry>
<varlistentry><term><command>core</command></term><listitem><para>(default)
compiles all sources, builds stubs and skeletons; and assembles EJB JAR, WAR
and EAR files. This is the default target for all <filename>build.xml</filename>
files shipped in the Sun ONE Application Server.</para>
</listitem></varlistentry>
<varlistentry><term><command>javadocs</command></term><listitem><para>creates
Java docs in <filename><replaceable>sample_dir</replaceable>/javadocs</filename></para>
</listitem></varlistentry>
<varlistentry><term><command>all</command></term><listitem><para>builds core
and javadocs , verifies and deploys the application, and adds the resources..
</para>
</listitem></varlistentry>
<varlistentry><term><command>deploy</command></term><listitem><para>deploys
the application and automatically expands the EJB JAR; does not install Javadocs.
</para>
</listitem></varlistentry>
<varlistentry><term><command>undeploy</command></term><listitem><para>removes
the deployed sample from the Sun Java System Application Server.</para>
</listitem></varlistentry>
<varlistentry><term><command>clean</command></term><listitem><para>removes <filename><replaceable>
appname</replaceable>/build/</filename> and <filename><replaceable>appname
</replaceable>/assemble/</filename> and <filename><replaceable>appname</replaceable>/javadocs
</filename> directories.</para>
</listitem></varlistentry>
<varlistentry><term><command>verify</command></term><listitem><para>verifies
the deployment descriptors in the sample.</para>
</listitem></varlistentry>
</variablelist></refsect1>
<refsect1><title>&exam-tt;</title>
<example>
<title>Compiling and Assembling a Sample Application</title>
<para>Using the simple stateless EJB sample as an example, execute several
of the build targets as follows:</para>
<screen><userinput>cd install_root/samples/ejb/stateless/simple/src</userinput></screen>
<para>Execute the <command>compile</command> target to compile the Java sources
as follows:</para>
<screen><userinput>asant compile</userinput></screen>
<para>Execute the <command>war</command>, <command>ear</command>, and <command>
ejbjar</command> target to assemble the J2EE module files and the EAR file
as follows by:</para>
<screen><userinput>asant jar
asant war
asant ear</userinput></screen>
<para>Alternatively, all the above tasks can be accomplished by:</para>
<screen><userinput>asant core</userinput></screen>
<para>Since the default build target is <command>core</command> you can execute <command>
asant</command> without any arguments to rebuild the entire application.</para>
</example>
<example>
<title>Building Web-based Applications</title>
<para>You can build everything, including installing Javadocs, and deploying
the application by:</para>
<screen><userinput>asant all</userinput></screen>
<para>Additionally, you can build everything, except the Javadocs, but deploy
the application by:</para>
<screen><userinput>asant core</userinput>
or just,
<userinput>asant</userinput>
then,
<userinput>asant deploy</userinput></screen>
<para>To rebuild the <filename>ear</filename> after you have modified the
deployment descriptors without recompiling:</para>
<screen><userinput>asant ear
asant deploy</userinput></screen>
</example>
</refsect1>
<refsect1><title>&also-tt;</title>
<para>See the Apache Software Foundation at <ulink url="http://www.apache.org">
http://www.apache.org</ulink> and the Jakarta Ant documentation at <ulink
url="http://jakarta.apache.org/ant/index.html">http://jakarta.apache.org/ant/index.html
</ulink>.</para>
<para>SUNWant documentation is located in <filename>/usr/sfw/share/doc/ant
</filename>.</para>
<para>See also <link linkend="asadmin-1m"><citerefentry><refentrytitle>asadmin
</refentrytitle><manvolnum>1M</manvolnum></citerefentry></link>.</para>
<para>See the <citetitle>Sun Java System Application Server Developer's Guide
</citetitle> for information about special Ant tasks you can use.</para>
</refsect1>
</refentry>
<?Pub *0000007879>
