You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by Avlesh Singh <av...@gmail.com> on 2009/08/31 04:33:32 UTC

Latest Ant Contrib - AntWebTasks

I have added some zing to the existing WAR task and made it do a lot more
with this contrib - http://code.google.com/p/ant-web-tasks/
I would love to hear from everyone - Ant users, developers.

Cheers
Avlesh

Re: Latest Ant Contrib - AntWebTasks

Posted by Avlesh Singh <av...@gmail.com>.
I got a lot of personal responses from many people, with queries on how to
use the contrib.
Here's a quick start-up guide:

In the released version, this contrib can perform two tasks -
*Property Injection*: More about this here -
http://code.google.com/p/ant-web-tasks/wiki/PropertyInjection. Underneath is
a simple build.xml file's snippet to achieve the same.

<taskdef name="powerWar" classname="com.avlesh.antwebtasks.war.PowerWAR"
> classpath="/path/to/ant-web-tasks.jar"/>
> <target name="my-war-target">
>   <powerWar destfile="distribution/myapp.war" webxml="web/WEB-INF/web.xml"
> compress="true">
>     <!--
>        Replaces all ${BUILD.PROPERTY.NAME <http://build.property.name/>}
> inside all ".xml" and ".properties"
>        files in the "web" directory minus the "web.xml" file.
>
>        Note:
>        1. You can specify multiple <fileset> elements inside a single
> inject.
>        2. In this usage, the original files are not modified. Only the
> file's
>           InputStream is changed.
>     -->
>     <inject verbose="on">
>       <fileset dir="web">
>         <include name="**/*.xml"/>
>         <include name="**/*.properties"/>
>         <exclude name="**/web.xml" />
>       </fileset>
>     </inject>
>
>     <classes dir="${build.dir}/classes"/>
>     <lib dir="${lib.dir}">
>       <include name="*.jar" />
>     </lib>
>     <fileset dir="web">
>       <exclude name="**/web.xml" />
>     </fileset>
>   </powerWar>
> </target>
>

*Cache Busting*: For details go here -
http://code.google.com/p/ant-web-tasks/wiki/CacheBusting. Underneath is the
simplest build.xml snippet to make it work -

<taskdef name="powerWar" classname="com.avlesh.antwebtasks.war.PowerWAR"
> classpath="/path/to/ant-web-tasks.jar"/>
> <target name="my-war-target">
>   <powerWar destfile="distribution/myapp.war" webxml="web/WEB-INF/web.xml"
> compress="true">
>
>     <cacheBuster verbose="on" versionFile="version.txt">
>       <fileset dir="web">
>           <include name="**/*.jsp"/>
>       </fileset>
>       <rule from="/mysite/css/(.*).css"
>               to="/mysite/css/$1.css?random=%{version-file-txt}"/>
>
>       <rule from="/js/(.*).js"
>               to="/js/(.*)-%{version-file-txt}.js/>
>
>     </cacheBuster>
>
>     ...
>   </powerWar>
> </target>
>

Feedback, suggestions, contributions all welcome ...

Cheers
Avlesh

On Mon, Aug 31, 2009 at 8:03 AM, Avlesh Singh <av...@gmail.com> wrote:

> I have added some zing to the existing WAR task and made it do a lot more
> with this contrib - http://code.google.com/p/ant-web-tasks/
> I would love to hear from everyone - Ant users, developers.
>
> Cheers
> Avlesh
>