Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Repeat after me:</p> <blockquote> <p>Ant is not a programming language. It's a dependency matrix language.</p> </blockquote> <p>This is an important distinction. You don't tell Ant what to execute. You tell Ant what you need, and Ant will figure out what to do.</p> <p>I can tell you're having problems understanding Ant with all of those <code>&lt;antcall/&gt;</code>. That is a no-no because it could make you execute tasks more than once. Your build file also makes no sense.</p> <p>Use the target's <code>dependency</code> parameter. For example, here's a skeleton <code>build.xml</code> file:</p> <pre><code>&lt;project&gt; &lt;target name="clean"/&gt; &lt;target name="prepare"/&gt; &lt;target name="compile" depends="prepare"/&gt; &lt;target name="package" depends="compile"/&gt; &lt;target name="test-compile depends="compile"/&gt; &lt;target name="test" depends="test-compile"/&gt; &lt;target name="deploy" depends="package"/&gt; &lt;target name="post-test-results" depends="test"/&gt; &lt;target name="all" depends="clean,post-test-results,deploy"/&gt; &lt;/project&gt; </code></pre> <p>When I want to run my target <code>all</code>, I mainly mean I want to do a clean build, post my test results, and deploy the build. This is true with Makefiles too. I don't list all of my tasks. Why do I care if I do my prep work for compilation? It's not my concern.</p> <p>So I call, <code>all</code>, and that will call <code>clean</code>, <code>post-test-results</code>, and <code>deploy</code>. I have no idea what Ant will do beyond calling these three targets.</p> <p>Wait... What do I need to do in order to post my test results? Well, I may need to run my tests. Therefore, I have a dependency to <code>test</code> for my <code>post-test-results</code> target. But, in order to run my tests, I may have to compile them. So, there's a dependency to <code>test-compile</code> on my <code>test</code> target.</p> <p>In order to compile my tests, I have dependencies on the regular Java code. So, <code>test-compile</code> will depend upon <code>compile</code>. In order to compile, I have to prepare. Maybe that's building the necessary structure, or downloading the required jars. That's called before <code>compile</code>. Now, I can deploy. However, before I can deploy, I need to package my deployment. So, <code>deploy</code> depends upon <code>package</code>.</p> <p>Package itself depends upon <code>compile</code>, but so did my <code>compile-test</code>. Since I've already called <code>compile</code>, my <code>package</code> target doesn't have to do that. All it has to do is package up the already compiled class files.</p> <p>Thus, I'll probably execute the following targets in this order:</p> <ul> <li>clean</li> <li>prepare</li> <li>compile</li> <li>test-compile</li> <li>post-test-results</li> <li>package</li> <li>deploy</li> </ul> <p>My <code>all</code> target does hit all of my other targets, but I didn't have to list them all as dependencies or force them to build via <code>&lt;antcall/&gt;</code>s.</p> <p>It looks like you need to learn about Ant and how it works. Your sample Ant file is simply not valid. Ant uses an XML style structure. All tasks are XML style entities.</p> <p>Fortunately, there are a lot of good books on Ant. I would recommend Manning's <a href="http://www.manning.com/loughran/" rel="nofollow">Ant in Action</a> as a good starting point.</p> <p>One of the things you will find out is that you can specify batches of junit tests in a single <code>&lt;junit&gt;</code> task. This can be done via one or more <code>&lt;batchtest&gt;</code> sub-entities on the <code>&lt;junit&gt;</code> task. The <code>&lt;batchtest&gt;</code> will run all classifies that match a particular criteria. You can also use the <code>&lt;test&gt;</code> sub-entity on the <code>&lt;junit&gt;</code> task. The <code>&lt;test&gt;</code> sub-entity allows you to specify individual classfiles to run. Many times, these classfiles may simply call a specified set of other Junit classifies. This way, the developer can specify what tests to run and what tests to skip. </p> <p>You can control what tests to run or not run by using properties and not by creating dozens of testing tasks. This allows you to specify sets of tests without having to spawn multiple JUnit processes.</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.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      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