ant-contrib

Antcontrib <for> and <var unset=“true”> in ant?

二次信任 提交于 2019-12-08 06:40:31
问题 What versions of Antcontrib support <for> and also <var unset="true" /> in Antcontrib? (Or where can I go to find out that information?) 回答1: The task docs are here, but they don't say which versions of the library support which functions. However, there haven't been any new releases for years, so I suspect you already have the latest. Note that there is no <var unset="true"/> , it's <Variable unset="true"/> . Maybe that's your problem. 回答2: Version 1.0b2 has the for task, but you have to go

ant iterate over files

走远了吗. 提交于 2019-12-06 07:48:41
I want to iterate over a list of jars (undefined number) and add them all to the jar file. To add them I plan to use something like this: <jar id="files" jarfile="all.jar"> <zipfileset src="first.jar" includes="**/*.java **/*.class"/> <zipfileset src="second.jar" includes="**/*.java **/*.class"/> </jar> but how do I iterate over them? I don't have ant-contrib Thanks! Vladimir Just use zipgroupfileset with the Ant Zip task <zip destfile="out.jar"> <zipgroupfileset dir="lib" includes="*.jar"/> </zip> This will flatten all included jar libraries' content. VonC If you do not have access to ant

Stop ant script without failing build

萝らか妹 提交于 2019-12-05 21:02:20
问题 In my ant script I want to exit (stop executing build) without failing when a condition is met. I have tried to use: <if> <equals arg1="${variable1}" arg2="${variable2}" /> <then> <fail status="0" message="No change, exit" /> </then> </if> Ant script is stopped on condition but build is failed. I want to the build to be stopped but with no errors. I'm using "Invoke Ant" step in Jenkins. Thanks. 回答1: I would suggest to refactor your ant script by reconsidering your approach. If you approach

How to emulate if-elseif-else in Ant without using Ant-contrib?

时光怂恿深爱的人放手 提交于 2019-12-04 17:16:23
I need an if-elseif-else conditional statement in Ant. I do not want to use Ant-contrib. I tried the solution here <target name="condition.check"> <input message="Please enter something: " addproperty="somethingProp"/> <condition property="allIsWellBool"> <not> <equals arg1="${somethingProp}" arg2="" trim="true"/> </not> </condition> </target> <target name="if" depends="condition.check, else" if="allIsWellBool"> <echo message="if condition executes here"/> </target> <target name="else" depends="condition.check" unless="allIsWellBool"> <echo message="else condition executes here"/> </target>

Calling foreach in maven-antrun-plugin

我与影子孤独终老i 提交于 2019-12-04 07:30:15
I'm trying to set up maven to execute the LESS CSS preprocessor on a directory in my web project. The basic flow is: Maven calls maven-antrun-plugin. Ant-contrib <foreach/> loops through a directory and finds all the .less files and calls a target. The target executes Rhino, which executes LESS which converts the file. To do this, I have the following XML: <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-antrun-plugin</artifactId> <version>1.7</version> <executions> <execution> <phase>compile</phase> <configuration> <target name="processLessFile"> <!-- ... --> </target>

Stop ant script without failing build

青春壹個敷衍的年華 提交于 2019-12-04 04:54:26
In my ant script I want to exit (stop executing build) without failing when a condition is met. I have tried to use: <if> <equals arg1="${variable1}" arg2="${variable2}" /> <then> <fail status="0" message="No change, exit" /> </then> </if> Ant script is stopped on condition but build is failed. I want to the build to be stopped but with no errors. I'm using "Invoke Ant" step in Jenkins. Thanks. I would suggest to refactor your ant script by reconsidering your approach. If you approach your problem with "execution of a build when a certain condition is met" instead of "failing the build if

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

微笑、不失礼 提交于 2019-12-01 08:15:45
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\feilong\feilong-platform\tools\feilong-tools-ant\build.xml:32: if doesn't support the nested "endswith

How can I iterate over properties from a file?

不问归期 提交于 2019-11-30 08:41:59
All my projects and their versions are defined in a properties file like this: ProjectNameA=0.0.1 ProjectNameB=1.4.2 I'd like to iterate over all the projects, and use their names and versions in an Ant script. At present I read the entire file using the property task, then iterate over a given list in a for loop like this: <for list="ProjectNameA,ProjectNameB" param="project"> <sequential> <echo message="@{project} has version ${@{project}}" /> </sequential> </for> How can I avoid the hard-coding of the project names in the for loop? Basically iterate over each line and extract the name and

There isn't antlib.xml in my ant-contrib-0.3

天大地大妈咪最大 提交于 2019-11-29 18:36:29
I am trying to use task for . I tried with this task definition: <taskdef resource="net/sf/antcontrib/antlib.xml"> <classpath> <pathelement location="${infrastructure-base-dir}/apache-ant-1.9.6/lib/ant-contrib-0.3.jar"/> </classpath> </taskdef> But didn't work. This message appear: Problem: failed to create task or type for So I decider to unzip ant-contrib-0.3.jar to see what's inside. And there wasn't antlib.xml in this path: net/sf/antcontrib/ . So what would you advise me in order to make task FOR to work? Try this: In your build.xml <taskdef name="for-contrib" classname="net.sf.antcontrib

execute Ant task if TWO conditions are met

家住魔仙堡 提交于 2019-11-29 13:37:50
The above ant script implements if dir_is_empty then git-clone else git-fetch using Ant-1.7.1 core statements: <target name="update" depends="git.clone, git.fetch" /> <target name="check.dir"> <fileset dir="${dir}" id="fileset"/> <pathconvert refid="fileset" property="dir.contains-files" setonempty="false"/> </target> <target name="git.clone" depends="check.dir" unless="dir.contains-files"> <exec executable="git"> <arg value="clone"/> <arg value="${repo}"/> <arg value="${dir}"/> </exec> </target> <target name="git.fetch" depends="check.dir" if="dir.contains-files" > <exec executable="git" dir=