Where are the classpath, path, and pathelement documented in Ant version 1.8.0?

I am looking at the documentation that ships with Apache Ant version 1.8.0 and cannot find where the class paths, path and patch are documented. I found a page that describes paths as structures, but does not list valid attributes or nested elements for them. Another thing I cannot find in the documentation is a description of the relationship between the file list, the set of files, the template and the outline and how to convert them back and forth. For example, there should be an easier way to compile only those classes in one package while removing all class dependencies on package classes and upgrade documentation.

<!-- Get list of files in which we're interested. --> <fileset id = "java.source.set" dir = "${src}"> <include name = "**/Package/*.java" /> </fileset> <!-- Get a COMMA separated list of classes to compile. --> <pathconvert property = "java.source.list" refid = "java.source.set" pathsep = ","> <globmapper from = "${src}/*.@{src.extent}" to = "*.class" /> </pathconvert> <!-- Remove ALL dependencies on package classes. --> <depend srcdir = "${src}" destdir = "${build}" includes = "${java.source.list}" closure = "yes" /> <!-- Get a list of up to date classes. --> <fileset id = "class.uptodate.set" dir = "${build}"> <include name = "**/*.class" /> </fileset> <!-- Get list of source files for up to date classes. --> <pathconvert property = "java.uptodate.list" refid = "class.uptodate.set" pathsep = ","> <globmapper from="${build}/*.class" to="*.java" /> </pathconvert> <!-- Compile only those classes in package that are not up to date. --> <javac srcdir = "${src}" destdir = "${build}" classpathref = "compile.classpath" includes = "${java.source.list}" excludes = "${java.uptodate.list}"/> <!-- Get list of directories of class files for package. --: <pathconvert property = "class.dir.list" refid = "java.source.set" pathsep = ","> <globmapper from = "${src}/*.java" to = "${build}*" /> </pathconvert> <!-- Convert directory list to path. --> <path id = "class.dirs.path"> <dirset dir = "${build}" includes = "class.dir.list" /> </path> <!-- Update package documentation. --> <jdepend outputfile = "${docs}/jdepend-report.txt"> <classpath refid = "compile.classpath" /> <classpath location = "${build}" /> <classespath> <path refid = "class.dirs.path" /> </classespath> <exclude name = "java.*" /> <exclude name = "javax.*" /> </jdepend> 

Note the number of conversions between file sets, paths, and a comma-separated list to get the correct type needed for different Ant tasks. Is there a way to simplify this when processing the smallest files in a complex directory structure?

+43
Mar 26
source share
2 answers

This is the closest I can find in the documentation on the class path.

http://ant.apache.org/manual/using.html#path

+11
Mar 26
source share

Path :

This object is the path used by the CLASSPATH or PATH environment variables. A path can also be described as a collection of unique file system resources.

and PathElement :

The helper class contains nested <pathelement> values.

are defined directly in JavaDoc.

ClassPath is an implementation of AbstractClasspathResource :

A resource representation for something accessed through the Java class loader. Basic methods for setting / resolving the classpath are provided.

which is a direct subclass of Resource :

Describes a "File-like" resource (File, ZipEntry, etc.). This class is intended for use by classes that should record information about the path and date / time of a file, zip record, or some similar resource (URL, archive in version control repository, ...).

Ant Class Diagram

FileSet is defined as:

FileSet is a group of files. These files can be found in the directory tree, starting from the base directory, and are mapped to patterns taken from several sets of patterns and selectors.

Selectors are defined as:

Selectors are a mechanism by which the files that make up a <fileset> can be selected based on criteria other than the file name, as shown by the <include> and <exclude> tags.

PatternSet is defined as:

Templates can be grouped by set, and later their id attribute. They are defined using the patternset element, which can be displayed nested in a FileSet or in a directory-based task that is an implicit FileSet. In addition, templates can be defined as an autonomous element at the same level as the target, i.e. As a child of the project, and as children of the target.

FileList is defined as:

File lists explicitly list files. While FileSets act as filters, returning only those files that exist on the file system and match the specified patterns, FileLists are useful for specifying files that may or may not exist. Several files are listed as a list of files with respect to the specified directory, without support for wildcard extensions (file names with wildcards will be included in the list without changes). Lists of files can be displayed inside tasks that support this feature or as stand-alone types.

Ant Resource Collections

In Schematron, you can verify this as follows:

  <sch:pattern> <sch:title>Check allowed elements</sch:title> <sch:rule context="target/*[name() = ancestor::*/taskdef/@name]"> <sch:assert test="true()"> The target element may contain user-defined tasks. </sch:assert> </sch:rule> </sch:pattern> 

References

0
Jun 21 '17 at 13:24
source share



All Articles