Ant « Development « Java I/O Q&A





1. How do I delete a dirset of directories with Ant?    stackoverflow.com

I want to delete all directories and subdirectories under a root directory that are contain "tmp" in their names. This should include any .svn files too. My first guess is to ...

2. How to use size of file inside Ant target    stackoverflow.com

I'm currently in the process of replacing my homebrewn build script by an Ant build script. Now I need to replace various tokens by the size of a specific file. I know ...

3. Best Practice For Creating Stub Files With Ant    stackoverflow.com

I'm trying to create myself a little build script to build a project for me - creating the desired directories, downloading any needed jars via Ivy/Maven and creating some stub files. The ...

4. Why doesn't my Ant master build file work properly?    stackoverflow.com

We have a bunch of Ant scripts, one for each of our subprojects. In the end we want to run all of these from a master build script and do some ...

5. Run some or all sections of an ant file    stackoverflow.com

Is there a way to specify an ANT file to run only one/some/all of its sections?

6. Ant copy file to leaf directory    stackoverflow.com

I'm trying to use Apache Commons Configuration and using ant for my build tool. I have one namespaced class, and when ant builds it of course sub-directories. ...

7. How do I obtain the file name from a directory name in Ant?    stackoverflow.com

I have a DirSet which I would like to convert to a comma-delimited list of directory names. I'm not interested in the full path, just the names. Using the ant-contrib "for" ...

8. Ant Copy Task: Failed to copy due to java.io.FileNotFoundException    stackoverflow.com

I'm trying to compile a Flex application in Ant (no problems here, I can do it fine). When I try to publish the contents of the project to a Windows network ...

9. Find working directory from Ant    stackoverflow.com

Is it possible to tell which directory the user ran Ant from? For example, I might want to run only the unit tests in the current working directory, rather than all tests ...





10. How do I specify a file to pass to a java process run by an Ant task?    stackoverflow.com

I have an Ant task to call a java process that takes a file on the command line. I can pass the file directly to the java program but I can't ...

11. referencing ant script location from within ant file    stackoverflow.com

I have a utility build script that gets called from a variety of project-specific build scripts on a build server. Everything works fine, until the relative directory structure changes. ...

12. How to copy the directory using Ant    stackoverflow.com

I have used copydir to copy the directory. Actually my directory contains some sub-directories, and some of those contain files and others contain sub-directories. How do I copy everything?

13. Copying only non-existent files in ant    stackoverflow.com

I'm deploying my project to a web-server to be deployed with java Web Start. However, Web Start uses modification date to figure out whether to download the resources again (by default). What ...

14. Ant task that processes multiple files    stackoverflow.com

in Ant I want to execute a Java task on a fileset. I use the Java task to run rhino which runs a JS beautifier. The later works without any problems, ...

15. ANT task to move and rename, files and folders, recursively    stackoverflow.com

I have have a folder structure like so:

/PROJECT/PROJECT.html

/PROJECT/PROJECT_readme.txt

/PROJECT/PROJECT.css

/PROJECT/PROJECT.js

/PROJECT/abc_PROJECT_def.txt

/PROJECT/something.js

/PROJECT/other.txt

/PROJECT/somefolder/PROJECT_other.txt
I want to use ANT to copy the complete directory and also change the PROJECT string in the files or folder to a specified ...

16. Deleting a file in ant    stackoverflow.com

For ease of access, I have a couple of config files in the parent of a series of project folders. When building the projects, they need copying into one of the ...





17. Ant + Keeping a control value    stackoverflow.com

I need to keep a control value (possibly inside a file), in order to decide whether to execute a task or not. I'm coming from here: http://stackoverflow.com/questions/2239236/ant-how-can-i-subtract-two-properties-containing-timestamps What I want to do, ...

18. copy subfolders to a directory using ant    stackoverflow.com

I want to copy a lot of subfolders and its content from various other folders to one specific folder. I also want to use a patternset to choose the subfolders to copy. For ...

19. java ant: does ant build files have a @var@ parameters and how to handle them?    stackoverflow.com

I downloaded a red5 ant sample project. (http://osflash.org/red5) the project contains several XML files that contain @new.project.name@ parameter:

build.xml
ivy.xml
src/logback.xml
www/WEB-INF/red5-web.properties
www/WEB-INF/web.xml
now.. should i edit and manually replace @new.project.name@ with the actual project name or is ...

20. Problem with ant file    stackoverflow.com

I have this build.xml file http://gist.github.com/315109 . Every task runs smoothly, but test. I don't know why I'm getting (if I run ant with -v) something like this:

[junit] ...

21. How to use Apache ivy to resolve dependency with multiple files?    stackoverflow.com

Here is my ivy.xml:

<?xml version="1.0" encoding="UTF-8"?>
<ivy-module version="2.0">
...
<dependencies>
    <dependency org="spring" name="richclient" rev="1.1.0"/>
</dependencies>
</ivy-module>
And ivy-settings.xml:
<property name="ivy.local.default.root"             value="/home/---/dev/Java/_libraries/_ivy" override="false"/>
<property name="ivy.local.default.ivy.pattern" ...

22. Is there a way to conditionally copy a file using ant?    stackoverflow.com

I have the following target:

<target name="promptforchoice">

  <input addproperty="choice">
     Copy the file?.  [Y, n]
  </input>

    <condition property="copy.file">
      ...

23. How to let idlj compile idl files in ant    stackoverflow.com

I've no idea how to compile my idl files with the sun-idl compiler (idlj) with the help of ant? Does anyone have an idea?

24. can I use 2 ivy files?    stackoverflow.com

I'm creating a build environment for third party developers. I want to provide them with an ivy.xml which a 3rd party shouldn't change and also a ivy-custom.xml which they should ...

25. ANT waiting for file creation    stackoverflow.com

is it possible to configure the ANT to pause the building process untill a file is created (with relative timeout)?

26. Delete duplicate files using ant?    stackoverflow.com

Is there a way to delete duplicate files using ant? Specifically, if I have the same file name in two different output directories, I want to delete it from the ...

27. How do I get Ivy to copy the dependencies to the lib directory when using it from the command line?    stackoverflow.com

I have the following command:

java -jar ...\ivy-2.2.0-rc1.jar -ivy ...\ivy.xml
Which I am expecting to resolve the dependencies and copy them to the lib folder of my project. Ivy seems to resolve the dependencies ...

28. How do i execute an ant task on files in a specified folder?    stackoverflow.com

I have to preprocess some state machine (.sm) files using a compiler to generate java code before compiling the rest of my project, and using an ant task to do it. ...

29. Ant copy files    stackoverflow.com

Is there any command in ant to copy files from one folder structure to another without checking the last modified date/time overwriting files. Basically I want all extra files from folder ...

30. Import an Ant classpatch from another file    stackoverflow.com

I'm exploring the awesomeness of Ant 1.8.1's import ability. Here's my situation: I have a top-level Ant file (project.xml) that turns around and calls ant on another Ant file (say, neato_project.xml) ...

31. Is it possible to create ant build file programmatically?    stackoverflow.com

Is it possible to create ant build file from java code using ant API? Thank you for your help.

32. Ant: put directory path into a file    stackoverflow.com

In ant, I need to create a file named "current_build" with the only content (in plaintext) being the full name of the directory: So I have this:

    <echo file="${trainer.dir}/current_build">${trainer.dir}</echo>
And ...

33. Does Ant Support File-based Dependencies?    stackoverflow.com

I would like to make an ant dependency where the target file depends on a source file. How do you describe this in ant? For example, convert this Make target to ant

data.txt: ...

34. Ant -f not working but -file works    stackoverflow.com

Has anyone else seen ANT refuse to honour the -f option but happily work with the -file option.

ant -f cms.xml etc etc - gives the response: build.xml does not exist!

ant -file ...

35. Include outside files to receive the libraries renaming?    stackoverflow.com

Using yguard I am obfuscating a project and I would like to know IF it is possible to include files outside the building to receive only the libraries and functions new ...

36. Ant target to move directories out of another directory    stackoverflow.com


How to move directories to one directory using an Ant task? My directory structure is like:

my/directory/root
               |-dir1/one/same/lib
  ...

37. In an ant build script, can I reference a path in a different build file?    stackoverflow.com

I have a path with an id in one build file. I have another build file which requires a path containing the same jars that are defined in the first build ...

38. cpptasks failing to create history file    stackoverflow.com

I am trying to run 4 parallel cpptasks on 4 seperate OS.. on the same set of code, outputting to OS specific directories so that there is no overstepping during the ...

39. Build multiple projects in ANT with one build file    stackoverflow.com

Can I build multiple projects from one build-file. Example:

<project basedir="." default="all" name="app1">
    ...
</project>

<project basedir="." default="all" name="app2">
    ...
</project>
Currently I type ant -f build1.xml compile and it ...

40. java ant delete file type    stackoverflow.com

In ant build script, how can I delete all *.java file in one directory and its subdirectory ? Thanks.

41. Configuring clover exclude file patterns    stackoverflow.com

Greetings, I have clover 3.0 setup using ant, with the following file exclusions:

<clover-setup initString="${clover.initstring}" flushpolicy="threaded" flushinterval="30000">
    <methodContext name="tostring" regexp="(.* )?public String toString\(.*\).*" />
    <files>
  ...

42. How to compose directories structures with Ant?    stackoverflow.com

I have directories structure like:

-first_dir
   -a
   -b
   -c
-second_dir
   -a
   -b
   -c
I would like to create a path element in ...

43. How to copy files using Ant between two computers with a low speed of connection?    stackoverflow.com

I had two computers that are located in different parts of the world (Russia and USA) and I need to copy many (100+) small files from one machine to another with ...

44. Calling ant file through java code    stackoverflow.com

I need to call an ant build in java code. I try to use Runtime class. I dont know how to give the ant build to the following code. I ...

45. Error while using Ant API for compilation of Java files - "error starting modern compiler"    stackoverflow.com

I am programmatically using Ant to compile a set of Java files (using the javac task). On execution of the Java program, I get the error: Error starting modern compiler However, when I ...

46. Java Ant - how to pass a ProGuard task arguments and use them inside a configuration file?    stackoverflow.com

I have this in my build.xml:

<target depends="build-jar" name="proguard">
    <taskdef resource="proguard/ant/task.properties" classpath="tools/proguard4.6/lib/proguard.jar" />
    <proguard configuration="ant/proguard.conf" />
</target>
It works fine. Inside the configuration file (i.e "ant/proguard.conf") I'm trying to ...

47. How do I solve Multiple artifacts of the module X are retrieved to the same file in Apache Ivy?    stackoverflow.com

I was using ANT to deploy my stuff to Tomcat. But I had trouble with missing dependencies and I wanted to add Ivy, cause it was reccomended. Now I added this to ...

48. Ant problem in including specific files    stackoverflow.com

I am not sure about how to configure my ANT Task here. I have this directory structure. Inside my java folder are my properties file. I wanted to include them when I ...

49. failing An ANT build file if the java program it's referring to throws an Exception    stackoverflow.com

I have the following Ant target :

<target name="getArchiverStatus" depends="exportContent">
<java classname="com.test.cms.build.GetErrorCountForArchiver"  failonerror="true">
<classpath>
<pathelement location="${cs.home}/${env}/main/main.jar" /> 
<fileset dir="${cs.home}/${env}/lib" includes="*.jar" />
</classpath>
<arg value="${cs.url}" />
<arg value="${cs.username}" />
<arg value="${cs.password}" />
<arg value="${ucm.archive.name}" />
<arg value="${ucm.workflow.logs.dir}" />
</java>
</target>
I want that this ...

50. Problematic make file for java    stackoverflow.com

JFLAGS = -d bin -cp lib/slick.jar:lib/lwjgl.jar

JC = javac

.SUFFIXES: .java .class

.java.class: $(JC) $(JFLAGS) src/$*.java

CLASSES = \
          Game.java \
      ...

51. Using ANT in Java to extract files    stackoverflow.com

I'm attempting to use the functionality of Ant to extract the contents of compressed files to a temporary folder. Obviously I'm doing one or more things wrong here, but what they ...

52. Is there any good tool to view and browse ant build file?    stackoverflow.com

I found it is hard to read an ant build file. Especially if the build file has lots of imported files, like property file and other xml build file. Therefore, I am ...

53. Using ANT to deploy applications    coderanch.com

Would anyone know of a good website where I can see an example of ANT deploying a .ear file to a local application server. Apparently, Ant can deploy the .ear to a particular directory on the server, stop the server and then start it again. Also, does anyone know where I can get an example of an application.xml - I am ...

55. using ant to achive files    coderanch.com

hi, im trying to use a build batch file to war a bunch of files together but i keep getting this error when i try and build it: Exception in thread "main" java.lang.NoClassDefFoundError: C:\jdk1/3/1\lib\htmlconverter/jar; I read on another page that the directory where the class is located is not in the classpath but i double check and it is set in ...

56. using ant to achive files    coderanch.com

hi, im trying to use a build batch file to war a bunch of files together but i keep getting this error when i try and build it: Exception in thread "main" java.lang.NoClassDefFoundError: C:\jdk1/3/1\lib\htmlconverter/jar; I read on another page that the directory where the class is located is not in the classpath but i double check and it is set in ...

57. copying file using ant script    coderanch.com

Hi , I am using ant script to copy a file to some other location. this file contains '@' symbol which is being replaced with some other special character while copying and therefore this file is not being executed on unix server. can anyone help to identify the problem or there can be any other approch to copy it. thanks in ...

58. Add file to Ant build?    forums.oracle.com

I'm not sure if this is where this belongs but I didn't see an Ant specific forum (please correct me if I'm wrong). I came into this project and I haven't really worked with Ant before so sorry if this is simple. I have a data file that the application needs to retrieve data from. I placed it in the main ...

59. Ant - deleting directory    forums.oracle.com

Hi all ... can anybody help me with deleting directories via Ant ? I have working build.xml where I delete directories, but problem occures when I try to delete non-existing directory. Is there a way how to tell ant that it should delete directory IF IT EXISTS ? I've tried to google it but I did not succeed. Thanks

60. Ant - copy file from one folder to many folders.How?    forums.oracle.com

Hi! I have folder "myproject". In this folder I have file "myfile.class". Aslo I have folder "myproject2" with many subfolders. I need to find the file "myfile.class" in folder "myproject2" and all it's subfolders and copy "myfile.class" from "myproject" to all subfolder (if "myfile.class" is exist in folder) in folder "myproject2". I want to do this with Ant. How I can ...

61. Ant build file    forums.oracle.com

62. Ant ; how to move nonjava files to the output folder whn i comile java file    forums.oracle.com

Hi when i compile my java file using javac ant task, i want to move non java file to the same output folder where the dot class file are stored. example if a package has 2 java file and a .properties file, when i javac task compile that package .properties file should move where the .class files are moving. can anyone ...

63. editing files with ant    forums.oracle.com

64. Running a java file with ant references    forums.oracle.com

Hello, This is my first post, first of all =) I am running a java file that starts out import org.apache.tools.ant.*; import java.io.*; // A custom listener needs to implement the // org.apache.tools.ant.BuildListener interface public class CMBuildListener implements org.apache.tools.ant.BuildListener { but running javac on this file says: CMBuildListener.java:1: package org.apache.tools.ant does not exist import org.apache.tools.ant.*; I have set ANT_HOME, JAVA_HOME and ...

65. ANT - CVS task to add a new file to CVS repository?    forums.oracle.com

add a new file? as in addition to the files that are already checked in? if so, i think you want to do adds first, then run the commit. also, if your files are in a subdirectory than the basdir which is probably ".", i had to use the dest attribute to tell it which folder to get the files to ...

66. Help - Ant script for copying specific files    forums.oracle.com

67. Ant script - recursively copying files by patterns in (sub)folders    forums.oracle.com

We have one big project that includes binaries and source code in deep hierarchy. We need separate this content into 'bin' and 'src' folder. All binary extensions (patterns) are defined in .cvsignore file. We decided use ant script to do this. Dude... You're deer hunting with a hammer. If I were the admin of the project, I'd probably have separated out ...

68. Run an ant file    forums.oracle.com

I have installed ant in my system. I have exported a build.xml file with eclipse. How do I run my program with ant on command line. If i go into the directory and type ant, it does some stuff and says BUILD SUCCESSFUL, but now how do i run the program? Thank you.

69. Execute ant file from command line    forums.oracle.com

Hello, i have written a program in eclipse and exported the ant file. I would like to run the program from command line, how do i do this? I tried the following command: java -cp . build.xml this gave me an error. Does anyone know the correct way of doing this? Thank you.