Bonjour,
je cherche a utiliser les variables de ANTCONTRIB afin de constituer une liste de modules dans une boucle. Merci pour votre aide
Voici mon code:
Output de l'exécution:
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32 <project name="buildEAIProduction" basedir="." default="importAllProjects"> <property name="ears.to.build" value="" /> <target name="initVariables" > <property name="working.directory" value="c:\build620" /> <property name="modules.list" value="m1,m2,m3,m4" /> <echo message="Modules: ${modules.list}" /> </target> <target name="initNecessaryJARs" depends="initVariables"> <echo message="TARGET: initNecessaryJARs" /> <taskdef resource="net/sf/antcontrib/antcontrib.properties"> <classpath> <pathelement location="${working.directory}\ant-contrib-1.0b3.jar" /> </classpath> </taskdef> </target> <target name="importAllProjects" depends="initNecessaryJARs"> <echo message="TARGET: importAllProjects on ${modules.list}" /> <foreach list="${modules.list}" target="importProject" param="currentProject" inheritall="true" trim="true" /> </target> <target name="importProject" > <echo message="AVANT concatenation modules: ears.to.build = [${ears.to.build}]" /> <var name="ears.to.build" value="${ears.to.build},${currentProject}" /> <echo message="APRES concatenation modules: ears.to.build = [${ears.to.build}]" /> </target> </project>
Ma version de Java: 1.5.0
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30 C:\BUILD620>\apache-ant-1.7.1\bin\ant -buildfile tvar.xml Buildfile: tvar.xml initVariables: [echo] Modules: m1,m2,m3,m4 initNecessaryJARs: [echo] TARGET: initNecessaryJARs importAllProjects: [echo] TARGET: importAllProjects on m1,m2,m3,m4 importProject: [echo] AVANT concatenation modules: ears.to.build = [] [echo] APRES concatenation modules: ears.to.build = [,m1] importProject: [echo] AVANT concatenation modules: ears.to.build = [] [echo] APRES concatenation modules: ears.to.build = [,m2] importProject: [echo] AVANT concatenation modules: ears.to.build = [] [echo] APRES concatenation modules: ears.to.build = [,m3] importProject: [echo] AVANT concatenation modules: ears.to.build = [] [echo] APRES concatenation modules: ears.to.build = [,m4] BUILD SUCCESSFUL Total time: 0 seconds
Version de ANT: 1.7.1
Version de ANTCONTRIB: Ant-Version: Apache Ant 1.6.5
Partager