Package org.apache.tools.ant
Class Main
- java.lang.Object
- 
- org.apache.tools.ant.Main
 
- 
- All Implemented Interfaces:
- AntMain
 
 public class Main extends java.lang.Object implements AntMain Command line entry point into Ant. This class is entered via the canonical `public static void main` entry point and reads the command line arguments. It then assembles and executes an Ant project.If you integrating Ant into some other tool, this is not the class to use as an entry point. Please see the source code of this class to see how it manipulates the Ant project classes. 
- 
- 
Field SummaryFields Modifier and Type Field Description static java.lang.StringDEFAULT_BUILD_FILENAMEThe default build file name.
 - 
Method SummaryModifier and Type Method Description protected voidaddBuildListeners(Project project)Adds the listeners specified in the command line arguments, along with the default listener, to the specified project.protected voidexit(int exitCode)This operation is expected to callSystem.exit(int), which is what the base version does.static java.lang.StringgetAntVersion()Returns the Ant version information, if available.static java.lang.StringgetShortAntVersion()Returns the short Ant version information, if available.static voidmain(java.lang.String[] args)Command line entry point.static voidstart(java.lang.String[] args, java.util.Properties additionalUserProperties, java.lang.ClassLoader coreLoader)Creates a new instance of this class using the arguments specified, gives it any extra user properties which have been specified, and then runs the build using the classloader provided.voidstartAnt(java.lang.String[] args, java.util.Properties additionalUserProperties, java.lang.ClassLoader coreLoader)Start Ant
 
- 
- 
- 
Field Detail- 
DEFAULT_BUILD_FILENAMEpublic static final java.lang.String DEFAULT_BUILD_FILENAME The default build file name. "build.xml"- See Also:
- Constant Field Values
 
 
- 
 - 
Constructor Detail- 
Mainpublic Main() Constructor used when creating Main for later arg processing and startup
 - 
Main@Deprecated protected Main(java.lang.String[] args) throws BuildExceptionDeprecated.since 1.6.xSole constructor, which parses and deals with command line arguments.- Parameters:
- args- Command line arguments. Must not be- null.
- Throws:
- BuildException- if the specified build file doesn't exist or is a directory.
 
 
- 
 - 
Method Detail- 
startpublic static void start(java.lang.String[] args, java.util.Properties additionalUserProperties, java.lang.ClassLoader coreLoader)Creates a new instance of this class using the arguments specified, gives it any extra user properties which have been specified, and then runs the build using the classloader provided.- Parameters:
- args- Command line arguments. Must not be- null.
- additionalUserProperties- Any extra properties to use in this build. May be- null, which is the equivalent to passing in an empty set of properties.
- coreLoader- Classloader used for core classes. May be- nullin which case the system classloader is used.
 
 - 
startAntpublic void startAnt(java.lang.String[] args, java.util.Properties additionalUserProperties, java.lang.ClassLoader coreLoader)Start Ant
 - 
exitprotected void exit(int exitCode) This operation is expected to callSystem.exit(int), which is what the base version does. However, it is possible to do something else.- Parameters:
- exitCode- code to exit with
 
 - 
mainpublic static void main(java.lang.String[] args) Command line entry point. This method kicks off the building of a project object and executes a build using either a given target or the default target.- Parameters:
- args- Command line arguments. Must not be- null.
 
 - 
addBuildListenersprotected void addBuildListeners(Project project) Adds the listeners specified in the command line arguments, along with the default listener, to the specified project.- Parameters:
- project- The project to add listeners to. Must not be- null.
 
 - 
getAntVersionpublic static java.lang.String getAntVersion() throws BuildExceptionReturns the Ant version information, if available. Once the information has been loaded once, it's cached and returned from the cache on future calls.- Returns:
- the Ant version information as a String
         (always non-null)
- Throws:
- BuildException- if the version information is unavailable
 
 - 
getShortAntVersionpublic static java.lang.String getShortAntVersion() throws BuildExceptionReturns the short Ant version information, if available. Once the information has been loaded once, it's cached and returned from the cache on future calls.- Returns:
- the short Ant version information as a String
         (always non-null)
- Throws:
- BuildException- BuildException if the version information is unavailable
- Since:
- Ant 1.9.3
 
 
- 
 
-