views:

102

answers:

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?

+1  A: 

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>
manyxcxi
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.
manyxcxi
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 `<exclude>` tag inside the `<fileset>` tag. IE: `<exclude name=".svn/**" />`
manyxcxi