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

Ant example source code file (typedef.xml)

This example Ant source code file (typedef.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 - Ant tags/keywords

The typedef.xml source code

<?xml version="1.0"?>

<project name="test" basedir="." default="invalid">

  <target name="invalid">
    <fail>This file should only be run via a testcase
  </target>

  <target name="empty">
    <typedef />
  </target>

  <target name="noClassname">
    <typedef name="dummy" />
  </target>

  <target name="noName">
    <typedef classname="org.example.types.TypedefTestType">
      <classpath refid="testclasses" />
    </typedef>
  </target>

  <target name="classNotFound">
    <typedef name="" classname="oops"/>
  </target>

  <path id="testclasses">
    <pathelement location="../../../../build/testcases" />
    <pathelement path="${java.class.path}" />
  </path>

  <typedef name="global"
           classname="org.example.types.TypedefTestType">
    <classpath refid="testclasses" />
  </typedef>

  <target name="testGlobal">
    <global id="global" />
  </target>

  <target name="testLocal">
    <typedef name="localtype"
             classname="org.example.types.TypedefTestType">
      <classpath refid="testclasses" />
    </typedef>
    <localtype id="local" />
  </target>

  <target name="double-notpresent">
    <typedef name="mytask" classname="notpresent" onerror="ignore"/>
    <typedef name="mytask" classname="notpresent" onerror="ignore"/>
    <typedef name="mytask" classname="org.apache.tools.ant.taskdefs.Echo"
             onerror="ignore"/>
    <mytask>hi
  </target>
  
  <target name="noresourcefailall">
  	<typedef resource="somenotpresentfile.properties" onerror="failall"/>
  </target>
  
  <target name="noresourcefail">
  	<typedef resource="somenotpresentfile.properties" onerror="fail"/>
  </target>
  
  <target name="noresourcenotfail">
  	<typedef resource="somenotpresentfile.properties" />
  </target>
</project>

Other Ant examples (source code examples)

Here is a short list of links related to this Ant typedef.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.