| <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> |
| <html> |
| <head> |
| <title> |
| Creating a new Ant build file |
| </title> |
| <link rel="stylesheet" href="../book.css" charset="ISO-8859-1" type="text/css"> |
| <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"> |
| <meta http-equiv="Content-Style-Type" content="text/css"> |
| </head> |
| <body> |
| <h1> |
| Creating a new Ant build file |
| </h1> |
| <p> |
| To create a new Ant build file for an AspectJ project: |
| </p> |
| <ol> |
| <li> |
| Either from the context menu or from the menu bar's <strong>File</strong> menu, select <strong>New > File</strong>. |
| </li> |
| <li> |
| Call the file <em>build.xml</em>. |
| </li> |
| <li> |
| Double click on the file to open in the Ant editor. |
| </li> |
| <li> |
| Edit the file as below: |
| <p><code><br> |
| <?xml version="1.0" encoding="UTF-8"?><br><br> |
| <project name="My Project" default="build" basedir="."><br><br> |
| |
| <target name="init" depends="init.variables,init.taskdefs" /> <br><br> |
| |
| <target name="init.variables" description="init variables"><br> |
| <property name="plugins.dir" location="${basedir}/../../plugins" /> <br> |
| <property name="aspectjrt.jar" location="${plugins.dir}/org.aspectj.runtime_1.5.0.20050610/aspectjrt.jar" /> <br> |
| <property name="aspectjweaver.jar" location="${plugins.dir}/org.aspectj.weaver_1.5.0.20050610/aspectjweaver.jar" /> <br> |
| <property name="ajde.jar" location="${plugins.dir}/org.aspectj.ajde_1.5.0.20050610/ajde.jar" /> <br> |
| </target><br><br> |
| |
| <target name="init.taskdefs" depends="init.variables" unless="taskdefs.init"><br> |
| <taskdef resource="org/aspectj/tools/ant/taskdefs/aspectjTaskdefs.properties"><br> |
| <classpath><br> |
| <pathelement path="${ajde.jar}" /> <br> |
| </classpath><br> |
| </taskdef><br> |
| <property name="taskdefs.init" value="true" /> <br> |
| </target><br><br> |
| |
| <target name="build" depends="init" description="build spacewar example"><br> |
| <iajc destDir="${basedir}/bin" classpath="${aspectjrt.jar}" fork="true"><br> |
| <forkclasspath><br> |
| <pathelement path="${plugins.dir}/org.eclipse.core.boot_3.1.0/boot.jar"/><br> |
| <pathelement path="${plugins.dir}/org.eclipse.core.resources_3.1.0/resources.jar"/><br> |
| <pathelement path="${plugins.dir}/org.eclipse.core.runtime_3.1.1/runtime.jar"/><br> |
| <pathelement path="${plugins.dir}/org.eclipse.core.runtime.compatibility_3.1.0/compatibility.jar"/><br> |
| <pathelement path="${plugins.dir}/org.apache.ant_1.6.5/lib/ant.jar"/><br> |
| <pathelement path="${ajde.jar}" /><br> |
| <pathelement path="${aspectjweaver.jar}" /><br> |
| </forkclasspath><br> |
| <srcdir><br> |
| <pathelement path="src/" /><br> |
| </srcdir><br> |
| </iajc><br> |
| </target><br><br> |
| |
| </project> <br><br> |
| </code> |
| </p> |
| </li> |
| <li> |
| <strong>Note: </strong>The path to the 'plugins' directory may be different on your machine and you may need |
| to add other paths to the classpath. Correct these to reflect the correct values. You will also need to change the version numbers as appropriate. |
| </li> |
| </ol> |
| <p> |
| Please see the AspectJ language guide for more information on the iajc Ant task. |
| </p> |
| |
| <p> |
| <img src="../images/ngrelt.gif" alt="Related tasks" border="0" height="27" width="159"> |
| </p> |
| <p> |
| <a href="buildconfigsandant.htm">Using build configurations with Ant</a><br> |
| <a href="newpluginbuildfile.htm">Creating an Ant build file for an AspectJ plug-in</a> |
| </p> |
| <p> |
| <a href="../notices.html"><img src="../cpy.gif" border="0" alt="Legal notices" width="324" height="14"></a> |
| </p> |
| </body> |
| </html> |
| |