Note that there are some explanatory texts on larger screens.

plurals
  1. POHow can I build multiple projects in Ant with one build file?
    primarykey
    data
    text
    <p>Can I build multiple projects from one build-file. Example:</p> <pre><code>&lt;project basedir="." default="all" name="app1"&gt; ... &lt;/project&gt; &lt;project basedir="." default="all" name="app2"&gt; ... &lt;/project&gt; </code></pre> <p>Currently I type <code>ant -f build1.xml compile</code> and it builds my application and I have to use two separate build files. Is there some way to get it running in a way that i have both the projects defined a common build-file and I can type something like <code>ant app1 compile</code> or <code>ant app2 compile</code>?</p> <p>Here's what my build-file looks like:</p> <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt; &lt;project name="azebooster" default="dist" basedir="."&gt; &lt;!-- Globals --&gt; &lt;property name="src" location="src/com/aelitis"/&gt; &lt;property name="build" location="build/azebooster"/&gt; &lt;property name="jar" location="jar/azebooster"/&gt; &lt;property name="resources" location="res/azebooster"/&gt; &lt;!-- Paths --&gt; &lt;path id="classpath"&gt; &lt;fileset dir="." includes="**/*.jar"/&gt; &lt;/path&gt; &lt;!-- Start it --&gt; &lt;target name="init"&gt; &lt;tstamp/&gt; &lt;mkdir dir="${build}"/&gt; &lt;mkdir dir="${jar}"/&gt; &lt;/target&gt; &lt;!-- Build it --&gt; &lt;target name="compile" depends="init" description="compile the source" &gt; &lt;javac srcdir="${src}" destdir="${build}"&gt; &lt;classpath&gt; &lt;path refid="classpath"/&gt; &lt;/classpath&gt; &lt;/javac&gt; &lt;/target&gt; &lt;!-- Jar it --&gt; &lt;target name="jar" depends="compile"&gt; &lt;jar destfile="${jar}/${ant.project.name}.jar"&gt; &lt;fileset dir="${build}"/&gt; &lt;fileset dir="${resources}" /&gt; &lt;/jar&gt; &lt;/target&gt; &lt;!-- Clean it --&gt; &lt;target name="clean" description="clean up" &gt; &lt;tstamp/&gt; &lt;delete dir="${build}"/&gt; &lt;delete dir="${jar}"/&gt; &lt;/target&gt; &lt;/project&gt; </code></pre> <p>Thank you.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload