1

I have checked out a java servlet project from subversion that has a strange organization.

All the java is in one directory and the resources ( JSPs, properties files, etc are in another ).

I want to use Ant to build the project, but then copy files to the appropriate Tomcat directory on my machine.

For example I would like to copy the JSP's from the source directory:

${basedir}/resources/${ant.project.name}/*.jsp

to the tomcat directory

${tomcat_home}/${ant.project.name}/

What would that look like in the build.xml file?

jeph perro
  • 6,242
  • 26
  • 90
  • 124
  • simple enough task and ant has a very good manual with a lot of examples about the copy task http://ant.apache.org/manual/Tasks/copy.html – shyam Jun 08 '10 at 20:00

1 Answers1

2

You want to use the ant copy task.

<copy todir="${tomcat_home}/${ant.project.name}">
   <fileset dir="${basedir}/resources/${ant.project.name}">
      <include name="**/*.jsp" />
   </fileset>
</copy>
ashurexm
  • 6,209
  • 3
  • 45
  • 69
  • the `**/*.jsp` means it will get all the .jsp files out of all subdirectories. You can change it to `*.jsp` to have it only get jsp files from the root dir. – ashurexm Jun 08 '10 at 19:51
  • As a side note, using the fileset you can tell it to NOT copy certain files as well (maybe .svn directories, for example) by putting an `` tag inside the `` tag. IE: `` – ashurexm Jun 11 '10 at 18:18