Hi Magnus:

<!-- if you want your project run target to run by just typing ant configure 
your build.xml as -->
<project name="magnus" default="run">

<!-- first setup the custom path to include necessary jars for the classpath 
here is an example: -->
    <path id="magnus.classpath">
        <pathelement location="${jar.dir}/bcel.jar"/>
        <pathelement location="${jar.dir}/dom4j-1.6.1.jar"/>
        <pathelement location="${jar.dir}/AppleJavaExtensions.jar"/>
        <pathelement location="${jar.dir}/junit.jar"/>
        <pathelement location="${jar.dir}/asm-3.1.jar"/>
        <pathelement location="${jar.dir}/asm-commons-3.1.jar"/>
        <pathelement location="${jar.dir}/asm-tree-3.1.jar"/>
        <pathelement location="${jar.dir}/jaxen-1.1.1.jar"/>        
        <pathelement location="${jar.dir}/jsr305.jar"/>
        <pathelement location="${jar.dir}/jFormatString.jar"/>
        <pathelement location="${jar.dir}/commons-lang-2.4.jar"/>
    </path>

<!-- now you can reference the classpath later on in the junit task -->
     <target name="run" depends="jar">
<junit printsummary="yes"> 
 <classpath
 <path refid="magnus.classpath"/>
</junit>
</target>

hth
Martin Gainty 
______________________________________________ 
Jogi és Bizalmassági kinyilatkoztatás/Verzicht und 
Vertraulichkeitanmerkung/Note de déni et de confidentialité
 Ez az
üzenet bizalmas.  Ha nem ön az akinek szánva volt, akkor kérjük, hogy
jelentse azt nekünk vissza. Semmiféle továbbítása vagy másolatának
készítése nem megengedett.  Ez az üzenet csak ismeret cserét szolgál és
semmiféle jogi alkalmazhatósága sincs.  Mivel az electronikus üzenetek
könnyen megváltoztathatóak, ezért minket semmi felelöség nem terhelhet
ezen üzenet tartalma miatt.

Diese Nachricht ist vertraulich. Sollten Sie nicht der vorgesehene Empfaenger 
sein, so bitten wir hoeflich um eine Mitteilung. Jede unbefugte Weiterleitung 
oder Fertigung einer Kopie ist unzulaessig. Diese Nachricht dient lediglich dem 
Austausch von Informationen und entfaltet keine rechtliche Bindungswirkung. 
Aufgrund der leichten Manipulierbarkeit von E-Mails koennen wir keine Haftung 
fuer den Inhalt uebernehmen.
Ce message est confidentiel et peut être privilégié. Si vous n'êtes pas le 
destinataire prévu, nous te demandons avec bonté que pour satisfaire informez 
l'expéditeur. N'importe quelle diffusion non autorisée ou la copie de ceci est 
interdite. Ce message sert à l'information seulement et n'aura pas n'importe 
quel effet légalement obligatoire. Étant donné que les email peuvent facilement 
être sujets à la manipulation, nous ne pouvons accepter aucune responsabilité 
pour le contenu fourni.




> Date: Wed, 20 Apr 2011 00:13:42 +0200
> Subject: Some feedback
> From: magnus.strandb...@gmail.com
> To: user@ant.apache.org
> 
> Hi,
> 
> I've just stated to learn Ant and must say it's a really good documentation.
> I've worked through the "Hello World with Apache Ant" and found a minor
> error in the "Testing the class" section.
> 
> The path id cannot be identified from the "junit" target. The path id should
> be global, e.g.
> 
>     <path id="application" location="${jar.dir}/${ant.project.name}.jar"/>
> 
>     ....
> 
>     <target name="run" depends="jar">
> 
>         <java fork="true" classname="${main-class}">
> 
>         <classpath>
> 
>         <path refid="classpath"/>
> 
>         <path refid="application"/>
> 
>         </classpath>
> 
>         </java>
> 
>     </target>
> 
>      <target name="junit" depends="jar">
> 
> <mkdir dir="${report.dir}"/>
> 
> <junit printsummary="yes">
> 
>             <classpath>
> 
>         <path refid="classpath"/>
> 
> <path refid="application"/>
> 
>     </classpath>
> 
>      <formatter type="xml"/>
> 
>      <batchtest fork="yes" todir="${report.dir}">
> 
> <fileset dir="${src.dir}" includes="*Test.java"/>
> 
>     </batchtest>
> 
> </junit>
> 
>     </target>
> 
> 
> 
> Br,
> 
> Magnus
                                          

Reply via email to