# Deprecated API

## Contents

- Deprecated Classes
- Deprecated Fields
- Deprecated Methods
- Deprecated Constructors

Deprecated Classes
Class and Description
org.apache.tools.ant.loader.AntClassLoader2 since 1.7 Just use `AntClassLoader` itself.
org.apache.tools.ant.loader.AntClassLoader5 since 1.9.7 Just use `AntClassLoader` itself.
org.apache.tools.ant.taskdefs.Copydir The copydir task is deprecated since Ant 1.2. Use copy instead.
org.apache.tools.ant.taskdefs.Copyfile The copyfile task is deprecated since Ant 1.2. Use copy instead.
org.apache.tools.ant.taskdefs.CopyPath this task should have never been released and was obsoleted by ResourceCollection support in Copy available since Ant 1.7.0. Don't use it.
org.apache.tools.ant.taskdefs.Deltree The deltree task is deprecated since Ant 1.2. Use delete instead.
org.apache.tools.ant.taskdefs.optional.extension.DeweyDecimal use org.apache.tools.ant.util.DeweyDecimal instead. Deprecated since ant 1.8
org.apache.tools.ant.taskdefs.Exec since 1.2. delegate to `Execute` instead.
org.apache.tools.ant.taskdefs.FixCRLF.OneLiner since 1.7.0.
org.apache.tools.ant.taskdefs.compilers.Javac12 Use `Javac13` instead.
org.apache.tools.ant.taskdefs.Jikes since 1.2. Merged into the class Javac.
org.apache.tools.ant.taskdefs.JikesOutputParser since 1.2. Use Jikes' exit value to detect compilation failure.
org.apache.tools.ant.taskdefs.KeySubst KeySubst is deprecated since Ant 1.1. Use Filter + Copy instead.
org.apache.tools.ant.taskdefs.optional.net.MimeMail since 1.6.x. Use `EmailTask` instead.
org.apache.tools.ant.taskdefs.Rename The rename task is deprecated since Ant 1.2. Use move instead.
org.apache.tools.ant.taskdefs.optional.RenameExtensions since 1.5.x. Use <move> instead
org.apache.tools.ant.util.ScriptRunner Implementation moved to another location. Use org.apache.tools.ant.util.optional.ScriptRunner instead.
org.apache.tools.ant.taskdefs.TaskOutputStream since 1.2.x. Use LogOutputStream instead.
org.apache.tools.ant.util.WeakishReference deprecated 1.7; will be removed in Ant1.8 Just use `WeakReference` directly.
org.apache.tools.ant.util.WeakishReference.HardReference since 1.7. Hopefully nobody is using this.
org.apache.tools.ant.util.optional.WeakishReference12 since 1.7. Just use `WeakReference` directly. Note that in ant1.7 is parent was changed to extend HardReference. This is because the latter has access to the (package scoped) WeakishReference(Object) constructor, and both that and this are thin facades on the underlying no-longer-abstract base class.

Deprecated Fields
Field and Description
org.apache.tools.ant.types.DataType.checked since 1.7. The user should not be directly referencing variable. Please use `DataType.setChecked(boolean)` or `DataType.isChecked()` instead.
org.apache.tools.ant.util.DateUtils.DATE_HEADER_FORMAT DateFormat is not thread safe, and we cannot guarantee that some other code is using the format in parallel. Deprecated since ant 1.8
org.apache.tools.ant.DirectoryScanner.DEFAULTEXCLUDES since 1.6.x. Use the `getDefaultExcludes` method instead.
org.apache.tools.ant.ProjectComponent.description since 1.6.x. You should not be accessing this variable directly.
org.apache.tools.zip.ZipOutputStream.EFS_FLAG use `GeneralPurposeBit.UFT8_NAMES_FLAG` instead
org.apache.tools.ant.util.CollectionUtils.EMPTY_LIST
org.apache.tools.ant.taskdefs.Tar.FAIL since 1.5.x. Tar.FAIL is deprecated and is replaced with Tar.TarLongFileMode.FAIL
org.apache.tools.ant.taskdefs.Tar.GNU since 1.5.x. Tar.GNU is deprecated and is replaced with Tar.TarLongFileMode.GNU
org.apache.tools.ant.Project.JAVA_1_0 since 1.5.x. Use `JavaEnvUtils.JAVA_1_0` instead.
org.apache.tools.ant.Project.JAVA_1_1 since 1.5.x. Use `JavaEnvUtils.JAVA_1_1` instead.
org.apache.tools.ant.Project.JAVA_1_2 since 1.5.x. Use `JavaEnvUtils.JAVA_1_2` instead.
org.apache.tools.ant.Project.JAVA_1_3 since 1.5.x. Use `JavaEnvUtils.JAVA_1_3` instead.
org.apache.tools.ant.Project.JAVA_1_4 since 1.5.x. Use `JavaEnvUtils.JAVA_1_4` instead.
org.apache.tools.ant.util.JavaEnvUtils.JAVA_1_9 use #JAVA_9 instead
org.apache.tools.ant.ProjectComponent.location since 1.6.x. You should not be accessing this variable directly. Please use the `ProjectComponent.getLocation()` method.
org.apache.tools.ant.taskdefs.Tar.OMIT since 1.5.x. Tar.OMIT is deprecated and is replaced with Tar.TarLongFileMode.OMIT
org.apache.tools.ant.ProjectComponent.project since 1.6.x. You should not be directly accessing this variable directly. You should access project object via the getProject() or setProject() accessor/mutators.
org.apache.tools.ant.types.DataType.ref since 1.7. The user should not be directly referencing variable. Please use `DataType.getRefid()` instead.
org.apache.tools.ant.Task.target since 1.6.x. You should not be accessing this variable directly. Please use the `Task.getOwningTarget()` method.
org.apache.tools.ant.Task.taskName since 1.6.x. You should not be accessing this variable directly. Please use the `Task.getTaskName()` method.
org.apache.tools.ant.Task.taskType since 1.6.x. You should not be accessing this variable directly. Please use the `Task.getTaskType()` method.
org.apache.tools.ant.taskdefs.Tar.TRUNCATE since 1.5.x. Tar.TRUNCATE is deprecated and is replaced with Tar.TarLongFileMode.TRUNCATE
org.apache.tools.ant.util.JavaEnvUtils.VERSION_1_9 use #VERSION_9 instead
org.apache.tools.ant.taskdefs.Tar.WARN since 1.5.x. Tar.WARN is deprecated and is replaced with Tar.TarLongFileMode.WARN
org.apache.tools.ant.Task.wrapper since 1.6.x. You should not be accessing this variable directly. Please use the `Task.getWrapper()` method.

Deprecated Methods
Method and Description
org.apache.tools.ant.taskdefs.compilers.DefaultCompilerAdapter.addExtdirsToClasspath(Path) since 1.5.x. Use org.apache.tools.ant.types.Path#addExtdirs instead.
org.apache.tools.ant.Project.addFilter(String, String) since 1.4.x. Use getGlobalFilterSet().addFilter(token,value)
org.apache.tools.ant.taskdefs.optional.junit.JUnitTask.addSysproperty(Environment.Variable) since ant 1.6
org.apache.tools.zip.ZipOutputStream.adjustToLong(int) use ZipUtil#adjustToLong
org.apache.tools.ant.taskdefs.Tar.archiveIsUpToDate(String[]) since 1.5.x. use the two-arg version instead.
org.apache.tools.ant.taskdefs.compilers.DefaultCompilerAdapter.assumeJava19() use #assumeJava9 instead
org.apache.tools.ant.ProjectHelper.configure(Object, AttributeList, Project) since 1.6.x. Use IntrospectionHelper for each property.
org.apache.tools.ant.taskdefs.XSLTProcess.configureLiaison(File) since Ant 1.7
org.apache.tools.ant.Project.copyFile(File, File) since 1.4.x
org.apache.tools.ant.Project.copyFile(File, File, boolean) since 1.4.x
org.apache.tools.ant.Project.copyFile(File, File, boolean, boolean) since 1.4.x
org.apache.tools.ant.Project.copyFile(File, File, boolean, boolean, boolean) since 1.4.x
org.apache.tools.ant.Project.copyFile(String, String) since 1.4.x
org.apache.tools.ant.Project.copyFile(String, String, boolean) since 1.4.x
org.apache.tools.ant.Project.copyFile(String, String, boolean, boolean) since 1.4.x
org.apache.tools.ant.Project.copyFile(String, String, boolean, boolean, boolean) since 1.4.x
org.apache.tools.ant.taskdefs.MacroInstance.createDynamicElement(String) since 1.6.x.
org.apache.tools.ant.IntrospectionHelper.createElement(Project, Object, String) since 1.6.x. This is not a namespace aware method.
org.apache.tools.ant.taskdefs.optional.jdepend.JDependTask.createSourcespath() since 1.6.x.
org.apache.tools.ant.util.FileUtils.createTempFile(String, String, File) since ant 1.7.1 use createTempFile(String, String, File, boolean, boolean) instead.
org.apache.tools.ant.util.FileUtils.createTempFile(String, String, File, boolean) since ant 1.7.1 use createTempFile(String, String, File, boolean, boolean) instead.
org.apache.tools.ant.taskdefs.optional.unix.Symlink.deleteSymlink(File) use org.apache.tools.ant.util.SymbolicLinkUtils#deleteSymbolicLink instead
org.apache.tools.ant.taskdefs.optional.unix.Symlink.deleteSymlink(String) use org.apache.tools.ant.util.SymbolicLinkUtils#deleteSymbolicLink instead
org.apache.tools.ant.taskdefs.Get.doGet(int, Get.DownloadProgress) only gets the first configured resource
org.apache.tools.ant.util.CollectionUtils.equals(Dictionary<?, ?>, Dictionary<?, ?>) since 1.6.x.
org.apache.tools.ant.util.CollectionUtils.equals(Vector<?>, Vector<?>) since 1.6.x.
org.apache.tools.ant.taskdefs.optional.script.ScriptDef.executeScript(Map, Map) since 1.7. Use executeScript(attribute, elements, instance) instead.
org.apache.tools.ant.launch.Locator.fileToURL(File) since 1.9, use `FileUtils#getFileURL(File)`
org.apache.tools.ant.RuntimeConfigurable.getAttributes() Deprecated since Ant 1.6 in favor of `RuntimeConfigurable.getAttributeMap()`.
org.apache.tools.ant.types.resources.Union.getCollection(boolean)
org.apache.tools.ant.ProjectHelper.getContextClassLoader() since 1.6.x. Use LoaderUtils.getContextClassLoader()
org.apache.tools.ant.types.ArchiveFileSet.getDirMode() since 1.7.
org.apache.tools.ant.BuildException.getException() Use `Throwable.getCause()` instead.
org.apache.tools.ant.types.ArchiveFileSet.getFileMode() since 1.7.
org.apache.tools.ant.Project.getFilters() since 1.4.x Use getGlobalFilterSet().getFilterHash().
org.apache.tools.ant.types.ArchiveFileSet.getFullpath() since 1.7.
org.apache.tools.tar.TarEntry.getGroupId() use #getLongGroupId instead as group ids can be bigger than `Integer.MAX_VALUE`
org.apache.tools.ant.Project.getJavaVersion() since 1.5.x. Use org.apache.tools.ant.util.JavaEnvUtils instead.
org.apache.tools.ant.util.JavaEnvUtils.getJavaVersionNumber() use #getParsedJavaVersion instead
org.apache.tools.ant.PropertyHelper.getNext() use the delegate mechanism instead
org.apache.tools.ant.util.FileUtils.getParentFile(File) since 1.7. Just use `File.getParentFile()` directly.
org.apache.tools.ant.types.ArchiveFileSet.getPrefix() since 1.7.
org.apache.tools.ant.taskdefs.Execute.getProcEnvironment() use #getEnvironmentVariables instead
org.apache.tools.ant.PropertyHelper.getProperty(String, String) namespaces are unnecessary.
org.apache.tools.ant.PropertyHelper.getPropertyHook(String, String, boolean) PropertyHelper chaining is deprecated.
org.apache.tools.ant.types.Mapper.getRef() since Ant 1.7.1 because a mapper might ref a FileNameMapper implementation directly.
org.apache.tools.ant.taskdefs.optional.jdepend.JDependTask.getSourcespath() since 1.6.x.
org.apache.tools.ant.taskdefs.optional.TraXLiaison.getSystemId(File) since 1.5.x. Use org.apache.tools.ant.util.JAXPUtils#getSystemId instead.
org.apache.tools.tar.TarEntry.getUserId() use #getLongUserId instead as user ids can be bigger than `Integer.MAX_VALUE`
org.apache.tools.ant.PropertyHelper.getUserProperty(String, String) namespaces are unnecessary.
org.apache.tools.ant.AntClassLoader.initializeClass(Class<?>) since 1.6.x. Use Class.forName with initialize=true instead.
org.apache.tools.ant.Diagnostics.isOptionalAvailable() Obsolete since Ant 1.8.2
org.apache.tools.ant.util.FileUtils.isSymbolicLink(File, String) use SymbolicLinkUtils instead
org.apache.tools.ant.util.FileUtils.newFileUtils() since 1.7. Use getFileUtils instead, FileUtils do not have state.
org.apache.tools.ant.ProjectHelper.parsePropertyString(String, Vector<String>, Vector<String>) since 1.6.x. Use PropertyHelper.
org.apache.tools.ant.PropertyHelper.parsePropertyString(String, Vector<String>, Vector<String>) use the other mechanisms of this class instead
org.apache.tools.ant.taskdefs.SQLExec.printResults(PrintStream) since 1.6.x. Use `the two arg version` instead.
org.apache.tools.ant.taskdefs.optional.image.Image.processFile(File) this method isn't used anymore
org.apache.tools.ant.util.CollectionUtils.putAll(Dictionary<? super K, ? super V>, Dictionary<? extends K, ? extends V>) since 1.6.x.
org.apache.tools.ant.util.StringUtils.replace(String, String, String) Use `String.replace(CharSequence, CharSequence)` now.
org.apache.tools.ant.ProjectHelper.replaceProperties(Project, String) since 1.6.x. Use project.replaceProperties().
org.apache.tools.ant.ProjectHelper.replaceProperties(Project, String, Hashtable<String, Object>) since 1.6.x. Use PropertyHelper.
org.apache.tools.ant.property.ResolvePropertyMap.resolveAllProperties(Map<String, Object>) since Ant 1.8.2, use the three-arg method instead.
org.apache.tools.ant.property.ResolvePropertyMap.resolveAllProperties(Map<String, Object>, String) since Ant 1.8.2, use the three-arg method instead.
org.apache.tools.ant.Project.resolveFile(String, File) since 1.4.x
org.apache.tools.ant.taskdefs.optional.net.FTP.setAction(String) since 1.5.x. setAction(String) is deprecated and is replaced with setAction(FTP.Action) to make Ant's Introspection mechanism do the work and also to encapsulate operations on the type in its own class.
org.apache.tools.ant.taskdefs.optional.net.FTPTask.setAction(String) since 1.5.x. setAction(String) is deprecated and is replaced with setAction(FTP.Action) to make Ant's Introspection mechanism do the work and also to encapsulate operations on the type in its own class.
org.apache.tools.ant.RuntimeConfigurable.setAttributes(AttributeList) since 1.6.x.
org.apache.tools.ant.taskdefs.optional.ReplaceRegExp.setByLine(String) since 1.6.x. Use setByLine(boolean).
org.apache.tools.zip.ZipEntry.setComprSize(long) since 1.7. Use setCompressedSize directly.
org.apache.tools.ant.taskdefs.FixCRLF.setCr(FixCRLF.AddAsisRemove) since 1.4.x. Use `setEol` instead.
org.apache.tools.ant.Project.setDefaultTarget(String) since 1.5.x. Use setDefault.
org.apache.tools.ant.taskdefs.Unpack.setDest(String) since 1.5.x. setDest(String) is deprecated and is replaced with setDest(File) to make Ant's Introspection mechanism do the work and also to encapsulate operations on the type in its own class.
org.apache.tools.ant.taskdefs.Ear.setEarfile(File) since 1.5.x. Use setDestFile(destfile) instead.
org.apache.tools.ant.taskdefs.Javadoc.setExtdirs(String) since 1.5.x. Use the `Javadoc.setExtdirs(Path)` version.
org.apache.tools.ant.taskdefs.Zip.setFile(File) since 1.5.x. Use setDestFile(File) instead.
org.apache.tools.ant.Project.setFileLastModified(File, long) since 1.4.x
org.apache.tools.ant.taskdefs.Concat.setForce(boolean) use #setOverwrite instead
org.apache.tools.ant.taskdefs.optional.ANTLR.setGlib(String) since ant 1.6
org.apache.tools.ant.PropertyHelper.setInheritedProperty(String, String, Object) namespaces are unnecessary.
org.apache.tools.ant.taskdefs.Jar.setJarfile(File) since 1.5.x. Use setDestFile(File) instead.
org.apache.tools.ant.taskdefs.Tar.setLongfile(String) since 1.5.x. setLongFile(String) is deprecated and is replaced with setLongFile(Tar.TarLongFileMode) to make Ant's Introspection mechanism do the work and also to encapsulate operations on the mode in its own class.
org.apache.tools.ant.taskdefs.SendEmail.setMailport(Integer) since 1.5.x. Use `EmailTask.setMailport(int)` instead.
org.apache.tools.ant.PropertyHelper.setNewProperty(String, String, Object) namespaces are unnecessary.
org.apache.tools.ant.PropertyHelper.setNext(PropertyHelper) use the delegate mechanism instead
org.apache.tools.ant.taskdefs.ExecuteJava.setOutput(PrintStream) since 1.4.x. manage output at the task level.
org.apache.tools.ant.taskdefs.optional.splash.SplashTask.setPassword(String) since 1.5.x. Use org.apache.tools.ant.taskdefs.optional.net.SetProxy
org.apache.tools.ant.taskdefs.optional.splash.SplashTask.setPort(String) since 1.5.x. Use org.apache.tools.ant.taskdefs.optional.net.SetProxy
org.apache.tools.ant.taskdefs.Copy.setPreserveLastModified(String) since 1.5.x. setPreserveLastModified(String) has been deprecated and replaced with setPreserveLastModified(boolean) to consistently let the Introspection mechanism work.
org.apache.tools.ant.PropertyHelper.setProperty(String, String, Object, boolean) namespaces are unnecessary.
org.apache.tools.ant.PropertyHelper.setPropertyHook(String, String, Object, boolean, boolean, boolean) PropertyHelper chaining is deprecated.
org.apache.tools.ant.taskdefs.optional.splash.SplashTask.setProxy(String) since 1.5.x. Use org.apache.tools.ant.taskdefs.optional.net.SetProxy
org.apache.tools.ant.taskdefs.Classloader.setReverse(boolean) use setParentFirst with a negated argument instead
org.apache.tools.ant.taskdefs.DefBase.setReverseLoader(boolean) since 1.6.x. stop using this attribute
org.apache.tools.ant.taskdefs.Execute.setSpawn(boolean)
org.apache.tools.ant.taskdefs.Unpack.setSrc(String) since 1.5.x. setSrc(String) is deprecated and is replaced with setSrc(File) to make Ant's Introspection mechanism do the work and also to encapsulate operations on the type in its own class.
org.apache.tools.ant.taskdefs.Tar.setTarfile(File) since 1.5.x. For consistency with other tasks, please use setDestFile().
org.apache.tools.ant.taskdefs.PathConvert.setTargetos(String) since 1.5.x. Use the method taking a TargetOs argument instead.
org.apache.tools.ant.taskdefs.Available.setType(String) since 1.5.x. setType(String) is deprecated and is replaced with setType(Available.FileDir) to make Ant's Introspection mechanism do the work and also to encapsulate operations on the type in its own class.
org.apache.tools.ant.taskdefs.Tstamp.CustomFormat.setUnit(String) since 1.5.x. setUnit(String) is deprecated and is replaced with setUnit(Tstamp.Unit) to make Ant's Introspection mechanism do the work and also to encapsulate operations on the unit in its own class.
org.apache.tools.ant.taskdefs.optional.splash.SplashTask.setUseproxy(boolean) since 1.5.x. Use org.apache.tools.ant.taskdefs.optional.net.SetProxy
org.apache.tools.ant.taskdefs.optional.splash.SplashTask.setUser(String) since 1.5.x. Use org.apache.tools.ant.taskdefs.optional.net.SetProxy
org.apache.tools.ant.taskdefs.Property.setUserProperty(boolean) since 1.5.x. This was never a supported feature and has been deprecated without replacement.
org.apache.tools.ant.PropertyHelper.setUserProperty(String, String, Object) namespaces are unnecessary.
org.apache.tools.ant.taskdefs.War.setWarfile(File) since 1.5.x. Use setDestFile(File) instead
org.apache.tools.ant.taskdefs.Zip.setZipfile(File) since 1.5.x. Use setDestFile(File) instead.
org.apache.tools.ant.types.CommandlineJava.size() since 1.7. Please dont use this, it effectively creates the entire command.
org.apache.tools.zip.ZipOutputStream.toDosTime(Date) use ZipUtil#toDosTime
org.apache.tools.zip.ZipOutputStream.toDosTime(long) use ZipUtil#toDosTime
org.apache.tools.ant.taskdefs.Touch.touch(File) since 1.6.x.
org.apache.tools.ant.Project.translatePath(String) since 1.7 Use FileUtils.translatePath instead.
org.apache.tools.ant.Diagnostics.validateVersion() Obsolete since Ant 1.8.2

Deprecated Constructors
Constructor and Description
org.apache.tools.ant.taskdefs.ExecuteWatchdog(int) since 1.5.x. Use constructor with a long type instead. (1.4.x compatibility)
org.apache.tools.ant.types.resources.FileResourceIterator() in favor of `FileResourceIterator.FileResourceIterator(Project)`
org.apache.tools.ant.types.resources.FileResourceIterator(File) in favor of `FileResourceIterator.FileResourceIterator(Project, File)`
org.apache.tools.ant.types.resources.FileResourceIterator(File, String[]) in favor of `FileResourceIterator.FileResourceIterator(Project, File, String[])`
org.apache.tools.ant.Main(String[]) since 1.6.x
org.apache.tools.ant.types.Reference() since 1.7. Please use `Reference.Reference(Project,String)` instead.
org.apache.tools.ant.types.Reference(String) since 1.7. Please use `Reference.Reference(Project,String)` instead.