Example 2

Create a War archive using web files from the directory web, but filter away all .svn directories. Use library files from the directory lib, class files from the directory classes and an inline web.xml file. Put the War file in the directory d.

JavaScript

new WarTF(). // Use a directory view to hide all .svn directories. // If we were to use a DirectoryAndFilter instead, we would have to use // a SuperParentOrFilter for hiding the .svn // directories since that filter would be applied to all entities returned // from the iterator used internally by WarTF. (See documentation above.) addSource(web.newView(new EntityNameFilter(".svn").not())). // This adds all Jar files in lib addLibraryFiles(Directories.getAllFilesMatching(lib, "*.jar")). addClassDirectory(classes). setWebXml( new CharSequenceReadableFile( "<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?>\n" + "<!DOCTYPE web-app\n" + " PUBLIC \"-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN\"\n" + " \"http://java.sun.com/j2ee/dtds/web-app_2_3.dtd\">\n" + "<web-app>\n" + " <servlet>\n" + " <servlet-class>org.example.DoerServlet</servlet-class>\n" + " <servlet-name>doer</servlet-name>\n" + " </servlet>\n" + " <servlet-mapping>\n" + " <servlet-name>doer</servlet-name>\n" + " <url-pattern>/*</url-pattern>\n" + " </servlet-mapping>\n" + "</web-app>")). setTarget(new FutureFile(d, "my.war")).run();


* An EntityFS-aware task is implemented using EntityFS. This means that it uses the filter settings of DirectoryView:s and also that it often can work with other file system implementations than File-based, such as the RAM file system.