ant

Define a list or a set of variables in ant

强颜欢笑 提交于 2019-12-10 17:21:50
问题 I'd like to define a list of variables in ant build file in order to use for loop with this list in my tasks. How can I do that? p.s.: It should be something like the following: <varlist name="mylist"> <!-- Actually, there is no such tag in Ant --> <item>someThing</item> <item>anotherThing</item> </varlist> ... <for param="item" list="${mylist}"> <sequential> <echo>@{item}</echo> </sequential> </for> 回答1: Not sure if this is what you meant: <echo message="The first five letters of the

Using Ant to build project and run JUnit Test Android app but Ant Junit Test fails

旧时模样 提交于 2019-12-10 17:21:26
问题 I have a simple Android project that I created. I also created Junit cases for the project. I have my Android app and TestCases in the same project. My structure is like the following: -AndroidApp -src -SampleActivity -tests -SampleActivityTest I have changed the Order and export options and made sure JUnit is at the top. I have added <instrumentation android:name="android.test.InstrumentationTestRunner" android:targetPackage="com.sample.app" android:label="UnitTest" /> <uses-library android

Using Ant to build multiple jars

泪湿孤枕 提交于 2019-12-10 17:18:33
问题 I have multiple Java eclipse projects. Each of them has "jardesc" file for building jar. It's nice - double click -> finish and jar file is made. But when i have to export several jars it's a pain - i have to repeat procedure several times. Please tell me, can i use Ant script to run several "jardesc" files at once (and get several jars according to each jardesc file)? How to do it? 回答1: Take a look at subant task in ant. You can create ant-file which would call other files to. <subant target

How to force a final ant target to execute regardless of dependencies

不想你离开。 提交于 2019-12-10 17:18:08
问题 I have a basic ant script in which I copy a set of files into a directory outside of any target. I would then like to clean those files up after any/all targets have run regardless of dependencies. The main problem I'm having is that the target can be 'compile' or 'deploywar' so I can't just blindly call the 'cleanUp' target from 'compile' because 'deploywar' might get called next. And I can't blindly call from just 'deploywar' because it might not get called. How can I define a target that

What is Junit trying to tell me when it throws a “NoTestsRemainException”

血红的双手。 提交于 2019-12-10 17:07:57
问题 I'm trying to run tests of the Apache POI project, but get the following exception. I saw it already a few times before, but every time I am completely lost about what JUnit is trying to tell me? Javadoc just states "Thrown when a filter removes all tests from a runner. ", but this does not mean an Ant-filter, because it is thrown inside JUnit, so which Filter is possibly removing tests here? How do I debug/fix an Ant-file that gives me this message? test-main: [junit] java.lang

How do I build a list of file names?

六月ゝ 毕业季﹏ 提交于 2019-12-10 16:39:21
问题 I need to write an Ant target that appends together (comma-delimited) a list of '.jar' file names from a folder into a variable, which is later used as input to an outside utility. I am running into barriers of scope and immutability. I have access to ant-contrib, but unfortunately the version I am stuck with does not have access to the 'for' task. Here's what I have so far: <target name="getPrependJars"> <var name="prependJars" value="" /> <foreach param="file" target="appendJarPath"> <path>

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 ?

Simple ant build script that supports src/ and test/?

一笑奈何 提交于 2019-12-10 16:17:26
问题 Currently I use an IDE for all my builds and unit tests. Now I have a need to use ant. I found a few simple ant build.xml scripts but they didn't support a separate Junit test/ dir. My projects are structured as follows: src/ com/foo/ com/bar/ test/ -- Mirror of src/, with all *Test.java files. com/foo/ com/bar/ lib/ -- All Java libs, including junit 4. How can a construct a small ant script that builds my src/ and test/ Java classes then runs all my JUnit tests? 回答1: I define <path> elements

ant sql insert statement fails on '--' strings. workaround?

守給你的承諾、 提交于 2019-12-10 16:13:48
问题 Context We're changing our install scripts to use ant's "sql" task and jdbc rather than proprietary sql clients sqlplus (oracle) and osql (msft). Updated: added more context. Our "base data" (seed data) consists of a collection of .sql files containing "vendor-neutral"(i.e. works both in oracle and mssql) sql statements. The Problem The scripts run fine, with one exception: This sql fails in Oracle. Specifically, something (ant or jdbc driver) treats the dashes/hyphens as "beginning of a

Ant modifying property file but escaping characters

时光怂恿深爱的人放手 提交于 2019-12-10 15:59:46
问题 I have an ant build script that is modifying a properties file. When it amends the properties with the new paths, it seems to escape the back slashes and colons. I understand this is probably working as intended but batch files use this property file further down the process and it is causing errors. Is there an ant solution to this, or should I start looking at a shell script workaround? Thanks, BON Ant target : <target name="modify_workstation_properties" depends="loadWinEnvVars,