blob: d8a8888640ed3cd1ed8b8ca3a26d450d9cc07c2c [file] [log] [blame]
<!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 &gt; 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>
&lt;?xml version="1.0" encoding="UTF-8"?&gt;<br><br>
&lt;project name="My Project" default="build" basedir="."&gt;<br><br>
&lt;target name="init"&gt;<br>
&nbsp;&nbsp;&lt;path id="ajde.classpath"&gt;<br>
&nbsp;&nbsp; &nbsp;&nbsp;&lt;pathelement path="../../plugins/org.eclipse.core.resources_3.2.1.R32x_v20060914.jar"/&gt;<br>
&nbsp;&nbsp; &nbsp;&nbsp;&lt;pathelement path="../../plugins/org.eclipse.core.runtime.compatibility_3.1.100.v20060603.jar"/&gt;<br>
&nbsp;&nbsp; &nbsp;&nbsp;&lt;pathelement path="../../plugins/org.eclipse.core.runtime_3.2.0.v20060603.jar"/&gt;<br>
&nbsp;&nbsp; &nbsp;&nbsp;&lt;pathelement path="../../plugins/org.eclipse.osgi_3.2.1.R32x_v20060919.jar"/&gt;<br>
&nbsp;&nbsp; &nbsp;&nbsp;&lt;pathelement path="../../plugins/org.eclipse.equinox.common_3.2.0.v20060603.jar"/&gt;<br>
&nbsp;&nbsp; &nbsp;&nbsp;&lt;pathelement path="../../plugins/org.eclipse.core.jobs_3.2.0.v20060603.jar"/&gt;<br>
&nbsp;&nbsp; &nbsp;&nbsp;&lt;pathelement path="../../plugins/org.eclipse.equinox.registry_3.2.1.R32x_v20060814.jar"/&gt;<br>
&nbsp;&nbsp; &nbsp;&nbsp;&lt;pathelement path="../../plugins/org.eclipse.equinox.preferences_3.2.1.R32x_v20060717.jar"/&gt;<br>
&nbsp;&nbsp; &nbsp;&nbsp;&lt;pathelement path="../../plugins/org.eclipse.core.contenttype_3.2.0.v20060603.jar"/&gt;<br>
&nbsp;&nbsp; &nbsp;&nbsp;&lt;pathelement path="../../plugins/org.eclipse.core.runtime.compatibility.auth_3.2.0.v20060601.jar"/&gt;<br>
&nbsp;&nbsp; &nbsp;&nbsp;&lt;pathelement path="../../plugins/org.eclipse.update.configurator_3.2.1.v20092006.jar"/&gt;<br>
&nbsp;&nbsp; &nbsp;&nbsp;&lt;pathelement path="../../plugins/org.eclipse.ant.core_3.1.100.v20060531.jar"/&gt;<br>
&nbsp;&nbsp; &nbsp;&nbsp;&lt;pathelement path="../../plugins/org.eclipse.core.variables_3.1.100.v20060605.jar"/&gt;<br>
&nbsp;&nbsp; &nbsp;&nbsp;&lt;pathelement path="../../plugins/org.eclipse.core.expressions_3.2.1.r321_v20060721.jar"/&gt;<br>
&nbsp;&nbsp; &nbsp;&nbsp;&lt;pathelement path="../../plugins/org.eclipse.core.filesystem_1.0.0.v20060603.jar"/&gt;<br>
&nbsp;&nbsp; &nbsp;&nbsp;&lt;pathelement path="../../plugins/org.eclipse.text_3.2.0.v20060605-1400.jar"/&gt;<br>
&nbsp;&nbsp; &nbsp;&nbsp;&lt;pathelement path="../../plugins/org.eclipse.core.commands_3.2.0.I20060605-1400.jar"/&gt;<br>
&nbsp;&nbsp; &nbsp;&nbsp;&lt;pathelement path="../../plugins/org.aspectj.ajde_1.5.3.200610201049/ajde.jar"/&gt;<br>
&nbsp;&nbsp; &nbsp;&nbsp;&lt;pathelement path="../../plugins/org.aspectj.weaver_1.5.3.200610201049/aspectjweaver.jar"/&gt;<br>
&nbsp;&nbsp; &nbsp;&nbsp;&lt;pathelement path="../../plugins/org.aspectj.runtime_1.5.3.200610201049/aspectjrt.jar"/&gt;<br>
&nbsp;&nbsp;&lt;/path&gt;<br>
&nbsp;&nbsp;&lt;taskdef resource="org/aspectj/tools/ant/taskdefs/aspectjTaskdefs.properties"&gt;<br>
&nbsp;&nbsp; &nbsp;&nbsp;&lt;classpath refid="ajde.classpath" /&gt;<br>
&nbsp;&nbsp;&lt;/taskdef&gt;<br>
&lt;/target&gt;<br><br>
&lt;target name="build" depends="init"&gt;<br>
&nbsp;&nbsp;&lt;delete dir="${basedir}/bin"/&gt;<br>
&nbsp;&nbsp;&lt;mkdir dir="${basedir}/bin"/&gt;<br>
&nbsp;&nbsp;&lt;path id="user.classpath"&gt;<br>
&nbsp;&nbsp; &nbsp;&nbsp;&lt;!-- add additional classpath entries here --&gt;<br>
&nbsp;&nbsp;&lt;/path&gt;<br>
&nbsp;&nbsp;&lt;!-- read additional ajc options from a file if required --&gt;<br>
&nbsp;&nbsp;&lt;property name="ajcArgFile" value=""/&gt;<br>
&nbsp;&nbsp;&lt;!-- fork the compiler --&gt;<br>
&nbsp;&nbsp;&lt;iajc destDir="${basedir}/bin" failonerror="true" argfiles="${ajcArgFile}"<br>
&nbsp;&nbsp; &nbsp;&nbsp;verbose="true" fork="true" maxmem="512m"&gt;<br>
&nbsp;&nbsp; &nbsp;&nbsp;&lt;forkclasspath refid="ajde.classpath" /&gt;<br>
&nbsp;&nbsp; &nbsp;&nbsp;&lt;forkclasspath refid="user.classpath" /&gt;<br>
&nbsp;&nbsp; &nbsp;&nbsp;&lt;src path="src/"/&gt;<br>
&nbsp;&nbsp;&lt;/iajc&gt;<br>
&lt;/target&gt;<br><br>
&lt;/project&gt; <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. Update these to reflect the correct values for your environment. 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="newpluginbuildfile.htm">Creating an Ant build file for an AspectJ plug-in</a>
</p>
</body>
</html>