alvinalexander.com | career | drupal | java | mac | mysql | perl | scala | uml | unix  

Friki example source code file (export-all.xml)

This example Friki source code file (export-all.xml) is included in the DevDaily.com "Java Source Code Warehouse" project. The intent of this project is to help you "Learn Java by Example" TM.

Java - Friki tags/keywords

app, app, apptype, apptype, dstamp, dstamp, root-class, tstamp, tstamp

The Friki export-all.xml source code

<project default="export">

  <target name="init">
    <property file="project.prp"/>
    <property file="deploy.prp"/>

    <property name="deploy.target" value="none"/> 
    <property name="deploy.name" value="${APP}"/> 
    <property name="APPTYPE" value="jar"/> 
    
    <echo message="building project name '${APP}' of type '${APPTYPE}'"/>

    <!-- generate derived properties -->
    <propertyfile file="temp/derived.prp">
      <entry key="apptype.${APPTYPE}" value="true"/>
    </propertyfile>
    <property file="temp/derived.prp"/>
    
    <property name="deployfile" value="${allprojects}/deploy-${deploy.target}.prp"/>
    <echo message="loading deployment properties from file '${deployfile}'"/>
    <property file="${deployfile}"/>
  </target>

  <target name="export-src" depends="init">
    <jar jarfile="../_dist/${APP}-${DSTAMP}-${TSTAMP}-src.zip" basedir="." />
    <copy file="../_dist/${APP}-${DSTAMP}-${TSTAMP}-src.zip" tofile="${thisproject}/${APP}-src.zip" filtering="off" overwrite="true"/>
    <copy file="${thisproject}/${APP}-src.zip" tofile="../_dist/${APP}-src.zip" filtering="off" overwrite="true"/>
  </target>

  <target name="export-jar" depends="process" if="apptype.jar">
    <jar jarfile="../_dist/${APP}-${DSTAMP}-${TSTAMP}.jar" basedir="${build}/delivery/classes" />
    <copy file="../_dist/${APP}-${DSTAMP}-${TSTAMP}.jar" tofile="../_dist/${APP}.jar" filtering="off" overwrite="true"/>
    <copy file="../_dist/${APP}-${DSTAMP}-${TSTAMP}.jar" tofile="${superlib}/${APP}.jar" filtering="off" overwrite="true"/>
  </target>
  
  <target name="copy-resources" if="exists.resources">
    <copy todir="${lib}" filtering="off" overwrite="true">
      <fileset dir="${resources}">
        <include name="*.jar"/>
      </fileset>
    </copy>
  </target>
  
  <target name='build-stripped-jar' if="ROOT-CLASS">
    <taskdef name="genjar" 
      classname="org.apache.tools.ant.taskdefs.optional.genjar.GenJar" classpath="${classpath}" />
    <genjar jarfile="${lib}/${APP}.jar">
      <classpath refid="classpath"/>
      <class name="${ROOT-CLASS}" />
      <manifest generateEntryAttributes='no' />
    </genjar>
  </target>
  
  <target name='build-whole-jars' unless="ROOT-CLASS">
    <antcall target="copy-resources"/>
    <jar jarfile="${lib}/${APP}.jar" basedir="${build}/delivery/classes" />
  </target>
  
  <target name="build-war-lib" depends="process" if="apptype.war">
    <antcall target="build-whole-jars"/>
    <antcall target="build-stripped-jar"/>
  </target>

  <target name="export-war" depends="process, build-war-lib" if="apptype.war">
    <war warfile="${thisproject}/${deploy.name}.war" 
      webxml="${build}/delivery/WEB-INF/web.xml">
      <fileset dir="${build}/delivery">
        <exclude name="classes/**"/>
        <exclude name="${libleaf}/**"/>
        <exclude name="WEB-INF/web.xml"/>
      </fileset>
      <lib dir="${lib}"/>
    </war>
    <copy file="${thisproject}/${deploy.name}.war" tofile="../_dist/${APP}-${DSTAMP}-${TSTAMP}.war" filtering="off" overwrite="true"/>
  </target>

  <target name="export-zip" depends="process, copy-resources" if="apptype.zip">
    <zip zipfile="../_dist/${APP}-${DSTAMP}-${TSTAMP}.zip" basedir="${build}/delivery" />
    <copy file="../_dist/${APP}-${DSTAMP}-${TSTAMP}.zip" tofile="../_dist/${deploy.name}.zip" filtering="off" overwrite="true"/>
  </target>

  <target name="export" depends="export-jar, export-war, export-zip, export-src"/>

</project>

Other Friki examples (source code examples)

Here is a short list of links related to this Friki export-all.xml source code file:

... this post is sponsored by my books ...

#1 New Release!

FP Best Seller

 

new blog posts

 

Copyright 1998-2024 Alvin Alexander, alvinalexander.com
All Rights Reserved.

A percentage of advertising revenue from
pages under the /java/jwarehouse URI on this website is
paid back to open source projects.