ant-contrib

Iterate over for loop with fixed amount of iterations

雨燕双飞 提交于 2019-12-20 02:27:08
问题 I am using ant-contrib library in my ant scripts, but I do not get how can I make a fixed amount of loops using foreach tag? By fixed amount of iterations I do not mean some hardcoded value, but the ant property, supplied from command line. 回答1: The following code creates a loop with a fixed number of 5 iterations: <target name="example"> <foreach param="calleeparam" list="0,1,2,3,4" target="callee"/> </target> <target name="callee"> <echo message="${calleeparam}"/> </target> It prints

Use ant-contrib,how to use “endsWith”?

╄→гoц情女王★ 提交于 2019-12-19 09:39:17
问题 the ant-contrib lastest version is ant-contrib-1.0b3.jar ? http://ant-contrib.sourceforge.net/tasks/tasks/more_conditions.html this document show endsWith condition But I use ant 1.8.2 And ant-contrib-1.0b3.jar , I cann't find the endsWith condition <if> <endswith string="D:\FeiLong Soft\Essential\Development\repository\org\springframework\spring-beans" with="spring-beans" /> <then> <echo>equals</echo> </then> <else> <echo>not equals</echo> </else> </if> But result: BUILD FAILED E:\Workspaces

ant-contrib: get count result in 'resourcecount' nested in <for/> loop

荒凉一梦 提交于 2019-12-13 04:54:32
问题 To search for multiple 'searchStrings' in a fileset the following ANT seems to do the job. <taskdef resource="net/sf/antcontrib/antlib.xml"> <classpath> <pathelement location="/usr/share/java/ant-contrib.jar"/> </classpath> </taskdef> <loadfile property="list" srcFile="searchStrings.txt"/> <echo>.:${list}:.</echo> <target name="main"> <for list="${list}" param="search4" delimiter="${line.separator}"> <sequential> <fileset id="existing" dir="../src"> <patternset id="files"> <include name="**/*

how to use ant-contrib tasks in eclipse auto content assist

落爺英雄遲暮 提交于 2019-12-12 20:25:05
问题 I have Eclipse Ganymede and would like to use the auto content assist feature for ant . I have the ant-contrib-1.0b3.jar with me. What configuration is required in eclipse to use auto content assist which can include tasks for ant-contrib as well? When I use the following the ant can recognize tasks for ant-contrib but content assist doesn't work? <!-- Define classpath for ant-contrib tasks --> <path id="ant.contrib.classpath"> <fileset dir="/path/to/lib/"> <include name="ant-contrib-1.0b3

how to do for loop based on a limit in Ant

故事扮演 提交于 2019-12-12 14:23:56
问题 In Ant-contrib, we can do something like: <for list="a,b,c,d" param="instence"> But if I don't have a list, I only have a limit, e.g. limit=4. Is there a way to do for loop based on limit, like: <for limit="4" param="index"> 回答1: The Ant addon Flaka provides some solutions for your problem. 1) Use a while loop the test attribute evaluates some EL expression, which maybe a simple counter, f.e. <project name="demo" xmlns:fl="antlib:it.haefelinger.flaka"> <!-- some counter --> <fl:let> countdown

Loop through directory structure in ant

落爺英雄遲暮 提交于 2019-12-11 15:33:10
问题 We want to loop through directory structure in ant without using foreach . Is there any elegant way to do the same ? 回答1: The apply task can iterate over a set of directories or files <target name="run-apply"> <apply executable="echo"> <dirset dir="src"/> </apply> </target> I personally like the groovy ANT task <target name="run-groovy"> <taskdef name="groovy" classname="org.codehaus.groovy.ant.Groovy"/> <dirset id="dirs" dir="src"/> <groovy> project.references.dirs.each { ant.echo it } <

Is there is a way to check Ant Target condition before target dependencies get executed

巧了我就是萌 提交于 2019-12-11 13:17:32
问题 I am trying to avoid antcall in my program, so trying to move antcall targets to target dependencies. Now I have a situation: <target name="test" depends="a,b,c" /> <target name="a" depends="a1,a2,a3" /> <target name="b" depends="b1,b2,b3" /> <target name="c" depends="c1,c2,c3" /> Till now every thing work fine. But if i just want to skip target 'c' and its dependencies from execution, <target name="c" depends="c1,c2,c3" if="skip.c" /> (considering the property "skip.c" is already set) Now

mapping multiple ivy files in Eclipse

£可爱£侵袭症+ 提交于 2019-12-11 11:36:05
问题 I'm currently changing my eclipse build paths with Ivy. I also modified my ANT build successfully by having 2 Ivy files loaded that retrieve my dependencies: In my portlet build file, I specifically call the common dependencies for all of the portlets which prevents me from specifying the same librairies in every Portlet project: <if> <available file="${rpm.homedir}/Builder/ivy_portlet.xml" /> <then> <echo message="Getting runtime portlet dependencies using Ivy project's configuration" />

ANT: split string into multiple parameters

好久不见. 提交于 2019-12-11 10:53:30
问题 I have just finished an ANT script (does the job perfectly). But there is a new requirement and script has to change. The goal is to have ANT deployment file called deploy-all.txt . The file will look like client1=name1=server1+server2=repositoryX client2=name2=server1+server3=repositoryY client3=name3=server2+server4=repositoryZ There will be only 1 client, only one name, from 1 to few servers, only one repository, and one type. What the goal is: for each line i need to get variables so i

How to <foreach> in a <macrodef>?

六月ゝ 毕业季﹏ 提交于 2019-12-10 16:25:36
问题 I have a xml just like below: <data> <foo>value1</foo> <foo>value2</foo> <foo>value3</foo> </data> I want to create macrodef which implements below function: <?xml version="1.0"?> <project name="OATS" default="execute" basedir="."> <xmlproperty file="data.xml" collapseAttributes="true"/> <target name="execute"> <foreach list="${data.foo}" target="runScript" param="script"/> </target> <target name="runScript"> <echo>Doing things with ${script}</echo> </target> </project> Anybody knows how to ?