ant

How can I check if file exists, and if not kill the build?

半腔热情 提交于 2020-01-02 00:50:56
问题 How can I stop a build, and notify the user if a file does not exist? I know I can use the available task to set a property if a file exists, but I'm not sure how I would stop a build and echo something. I would like to stick with core tasks if possible. 回答1: You can use the fail task for all your failing needs. The last example on that page is actually pretty much what you need <fail message="Files are missing."> <condition> <not> <resourcecount count="2"> <fileset id="fs" dir="." includes=

How to `chmod -R +w` with Ant, files and folders?

牧云@^-^@ 提交于 2020-01-02 00:38:08
问题 I'd like to do the equivalent of a chmod -R +w foo/ in an Ant build script. So far I'm using this: <chmod perm="g+w"> <dirset dir="${basedir}/foo"> </dirset> <fileset dir="${basedir}/foo"> </fileset> </chmod> Is there a neater way to write that to include files and folders recursively ? 回答1: The following does work: <chmod file="${basedir}/foo/**" perm="g+w" type="both"/> Credits shared with the OP. See also Chmod Task 回答2: To chmod one can use exec: <exec executable="chmod" dir="${basedir}

maven artifactId hadoop 2.2.0 for hadoop-core

二次信任 提交于 2020-01-01 18:56:11
问题 I am migrating my application from hadoop 1.0.3 to hadoop 2.2.0 and maven build had hadoop-core marked as dependency. Since hadoop-core is not present for hadoop 2.2.0. I tried replacing it with hadoop-client and hadoop-common but I am still getting this error for ant.filter. Can anybody please suggest which artifact to use? previous config : <dependency> <groupId>org.apache.hadoop</groupId> <artifactId>hadoop-core</artifactId> <version>1.0.3</version> </dependency> New Config: <dependency>

Exclude Jar from Ant Build using zipgroupfileset

落花浮王杯 提交于 2020-01-01 18:44:04
问题 I have created a Jar Project which contains Filter . I need to use servlet-api.jar when I compile the Filter code. But when I want to use the Jar in another application, I want to build the jar in such a way that it will exclude servlet-api.jar . I am using Apache Ant with NetBeans 8: I have added below code in build.xml . <target name="-post-jar"> <jar destfile="dist/MyJar.jar"> <zipfileset src="dist/MyJarAsLibrary.jar"/> <zipgroupfileset dir="dist/lib/." excludes="javax/*"/> </jar> </target

Ant strings comparison

余生颓废 提交于 2020-01-01 14:57:07
问题 I have a script in ant, and I need to compare 2 strings lexicographically. something like: "1.2.3".compareTo("1.2.4") I can't find a way to do so... Any ideas? I'm using ant 1.8, and ant-contrib. Thanks 回答1: For this solution to work you will need to have your JAVA_HOME pointing to JRE 1.6 or later. <project name="test" default="test"> <scriptdef name="compare" language="javascript"> <attribute name="lhs" /> <attribute name="rhs" /> <attribute name="property" /> <![CDATA[ var lhs = attributes

Ant strings comparison

微笑、不失礼 提交于 2020-01-01 14:56:29
问题 I have a script in ant, and I need to compare 2 strings lexicographically. something like: "1.2.3".compareTo("1.2.4") I can't find a way to do so... Any ideas? I'm using ant 1.8, and ant-contrib. Thanks 回答1: For this solution to work you will need to have your JAVA_HOME pointing to JRE 1.6 or later. <project name="test" default="test"> <scriptdef name="compare" language="javascript"> <attribute name="lhs" /> <attribute name="rhs" /> <attribute name="property" /> <![CDATA[ var lhs = attributes

[原]Android打包之Eclipse打包

允我心安 提交于 2020-01-01 12:52:37
Android自动打包流程详细图: 步骤一: 在工程中新建一个build.xml. 步骤二: 给工程配置ant工具。 选择ant工具的步骤如下: Windows->Shown view->Ant 这样就出项了ant视图框。在ant视图框中单击右键,选择addBuilderfile添加ant编译文件。 添加好ant编译文件后,我们还需要对编译文件进行设置:选中编译文件,右键单击选择Run As->external Tools configurations 弹出了ant编译的配置框。 在编译ant文件时,我们常常遇到编译进程卡住现象,这是因为ant编译器找不到日志输出文件造成的。可以在ant编译框中的Main->Argument文本框中添加如下语句:-logger org.apache.tools.ant.NoBannerLogger,这样指定ant编译时的日志编译器。 如果在编译工程时,遇到不可映射的字符集(工程字符集和ant编译器的字符集不一致)时,可以修改ant的编译时字符集 步骤如下:在ant编译配置框中选择common->Console Encoding设置ant的字符集 步骤三: 编写build.xml <?xml version="1.0" encoding="UTF-8"?> <project name="AndroidTouchDemo"> <!-- 指定配置文件 -

Can ivy or ivyDE add related jars into JAVA build path library automatically in Eclipse?

我是研究僧i 提交于 2020-01-01 11:37:08
问题 For example, when I open a well developed opensource project (like lucene) into Eclipse (with both ant build.xml and ivy ivysetting.xml), I can run ant with build.xml to build the whole project successfully. However, the project is full of errors in a mess of .java classes. This is caused by unlinking to the external jars. These jars are already download by ivy and stored in {user}/.ivy2/cache/. Also, when I manually put each of these jars into the build path of this project, the errors are

Calling foreach in maven-antrun-plugin

被刻印的时光 ゝ 提交于 2020-01-01 11:36:17
问题 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>

ant Unsupported major.minor version 52.0

走远了吗. 提交于 2020-01-01 10:10:11
问题 This is driving me nuts. When running any ant command (even ant -version ), I always get the following error on Mac OSX: Exception in thread "main" java.lang.UnsupportedClassVersionError: org/apache/tools/ant/launch/Launcher : Unsupported major.minor version 52.0 I removed and re-installed ant entirely, and still get the same error. For our company we have to run Java7 to run the command, so I created an alias. This used to work, I'm not sure what changed. 回答1: I see you have java 1.7