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

Friki example source code file (build-packed-jar.xml)

This example Friki source code file (build-packed-jar.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, can, can, root-class, root-class

The Friki build-packed-jar.xml source code

<project default="build-packed-jar">

  <property name="base" value=".."/>
  <property name="dest.dir" value="build/lib"/>
  <property name="jarfile.name" value="${APP}.jar"/>

  <target name="init">
    <available property="pack.exists" 
      classname="org.sadun.util.ant.Pack"
       classpath="_ext/pack.jar"/>
    
    <condition property="no-param">
      <not>
        <isset property="ROOT-CLASS"/>
      </not>
    </condition>

    <condition property="no-packer">
      <not>
        <istrue value="${pack.exists}"/>
      </not>
    </condition>
    
    <condition property="ok">
      <and>
        <isfalse value="${no-packer}"/>
        <isfalse value="${no-param}"/>
      </and>
    </condition>
    
  </target>

  <target name='pack' depends="init" if="ok">
    <mkdir dir="${dest.dir}"/>
    <taskdef name="pack" 
      classname="org.sadun.util.ant.Pack" classpath="_ext/pack.jar" />
    <pack 
      classes = "${ROOT-CLASS}"
      targetJar = "${dest.dir}/${jarfile.name}">
      <classpath>
        <pathelement location="build/delivery/classes"/>
        <fileset dir="_lib">
          <include name="**/*.jar"/>
        </fileset>
        <pathelement path="${java.class.path}"/>
      </classpath>
    </pack>
  </target>
  
  <target name='pack-lump' unless="ok">
    <mkdir dir="${dest.dir}"/>
    <jar 
      jarfile="${dest.dir}/${jarfile.name}"
      basedir="build/delivery/classes"/>
    <copy todir="${dest.dir}" filtering="off" overwrite="true">
      <fileset dir="_lib">
        <include name="*.jar"/>
      </fileset>
    </copy>
  </target>
  
  <target name='complain-param' depends="init" if="no-param">
    <echo message="Can not build packed jar file; needs property ROOT-CLASS"/> 
  </target>
  
  <target name='complain-packer' depends="init" if="no-packer">
    <echo message="Can not build packed jar file; needs class org.sadun.util.ant.Pack"/> 
  </target>

  <target name="build-packed-jar" depends="pack, complain-param, complain-packer, pack-lump"/>

</project>

Other Friki examples (source code examples)

Here is a short list of links related to this Friki build-packed-jar.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.