FranzMarcus.de


VersionProperty

Introduction

Version Property is an ant task. The task fills 4 ant properties named spec, impl, patch and string with version information. This information is loaded from a class file. So you can define static int fields in a class which are accessible from ant scripts. The properties are get a prefix the property ${version.string} holds e.g. 1.2.0
Prerequsites:
1. the class has to have a constructor that takes no parameters, so that the task can instanciate the class
2. the fields have to be of the type "int"

Download

VersionProperty.jar

Synatx

Attributes:
class: the class containing the versioninformation fields
spec: the field name where to find the spec value, defaults to SPECIFICATION
impl: the field name where to find the impl value, defaults to IMPLEMENTATION
patch: the field name where to find the patchlevel value, defaults to PATCHLEVEL
name: the prefix for the property to set, defaults to version

Definition of the task
	<target name="-VersionPropertyTask" depends="-init">
		<path id="VersionPropertyTask-Classpath">
		<fileset dir="${tools.path}">
		    <patternset refid="VersionProperty-Libary"/>
		</fileset>
	</path>

		<taskdef name="VersionProperty"	classname="de.franzmarcus.tools.version.ant.VersionProperty">
			<classpath refid="VersionPropertyTask-Classpath"/>
		</taskdef>
	</target>
Usage
		<ßVersionProperty class="de.franzmarcus.tools.properties.PropertiesCompiler">
			<classpath refid="VersionProperty-SearchClasspath"/>
		</VersionProperty>