Sets a property by name, or set of properties (from file or resource) in the project.
Properties are immutable: whoever sets a property first freezes it for the rest of the build; they are most definitely not variable.
There are seven ways to set properties:
prefix.availableProcessors,
prefix.freeMemory, prefix.totalMemory
and prefix.maxMemory will be defined with values
that correspond to the corresponding methods of the Runtime class.Although combinations of these ways are possible, only one should be used at a time. Problems might occur with the order in which properties are set, for instance.
The value part of the properties being set, might contain references to other properties. These references are resolved at the time these properties are set. This also holds for properties loaded from a property file.
Properties are case sensitive.| Modifier and Type | Field and Description |
|---|---|
| private File | |
| protected Path | |
| protected String | |
| private Project | |
| protected File | |
| protected String | |
| protected String | |
| private boolean | |
| protected Reference | |
| private boolean | |
| protected String | |
| private String | |
| private Object | |
| protected URL | |
| protected boolean | |
| protected String | |
| private boolean |
| Access | Constructor and Description |
|---|---|
| public | |
| protected | |
| protected |
| Modifier and Type | Method and Description |
|---|---|
| protected void | addProperties(Properties
the properties to iterate over props)iterate through a set of properties, resolve them then assign them |
| protected void | addProperty(String
name of property n, String value to set v)add a name value pair to the project property set |
| protected void | addProperty(String
name of property n, Object value to set v)add a name value pair to the project property set |
| public void | |
| public Path | |
| public void | |
| public Path | |
| public String | |
| public File | |
| public String | |
| public String | |
| public boolean | Returns: booleanWhether to apply the prefix when expanding properties on the right hand side of a properties file as well. |
| public Reference | |
| public String | |
| public String | |
| public URL | |
| public String | |
| private void | |
| protected void | |
| protected void | |
| private void | loadProperties(Properties
The property object to load into props, InputStream The input stream from where to load is, boolean true if we should try to load from xmlLoads the properties defined in the InputStream into the given property. |
| protected void | loadResource(String
name of resource to load name)load properties from a resource in the current classpath |
| protected void | |
| protected void | |
| private void | resolveAllProperties(Map<String, Object>
properties object to resolve props)resolve properties inside a properties hashtable |
| public void | |
| public void | setClasspath(Path
to add to any existing classpath classpath)The classpath to use when looking up a resource. |
| public void | setClasspathRef(Reference
a reference to a classpath r)the classpath to use when looking up a resource, given as reference to a <path> defined elsewhere |
| public void | |
| public void | |
| public void | |
| public void | |
| public void | |
| public void | setPrefixValues(boolean
boolean b)Whether to apply the prefix when expanding properties on the right hand side of a properties file as well. |
| public void | |
| public void | |
| public void | |
| public void | |
| public void | |
| public void | setUserProperty(boolean
ignored userProperty)
Deprecated
since 1.5.x.
This was never a supported feature and has been
deprecated without replacement.
|
| public void | |
| public void | |
| public String | Returns: the current value or the empty stringOverrides java. |
| basedir | back to summary |
|---|---|
| private File basedir | |
| classpath | back to summary |
|---|---|
| protected Path classpath | |
| env | back to summary |
|---|---|
| protected String env | |
| fallback | back to summary |
|---|---|
| private Project fallback | |
| file | back to summary |
|---|---|
| protected File file | |
| name | back to summary |
|---|---|
| protected String name | |
| prefix | back to summary |
|---|---|
| protected String prefix | |
| prefixValues | back to summary |
|---|---|
| private boolean prefixValues | |
| ref | back to summary |
|---|---|
| protected Reference ref | |
| relative | back to summary |
|---|---|
| private boolean relative | |
| resource | back to summary |
|---|---|
| protected String resource | |
| runtime | back to summary |
|---|---|
| private String runtime | |
| untypedValue | back to summary |
|---|---|
| private Object untypedValue | |
| url | back to summary |
|---|---|
| protected URL url | |
| userProperty | back to summary |
|---|---|
| protected boolean userProperty | |
| value | back to summary |
|---|---|
| protected String value | |
| valueAttributeUsed | back to summary |
|---|---|
| private boolean valueAttributeUsed | |
| Property | back to summary |
|---|---|
| public Property() Constructor for Property. | |
| Property | back to summary |
|---|---|
| protected Property(boolean userProperty) Constructor for Property.
| |
| Property | back to summary |
|---|---|
| protected Property(boolean userProperty, Project fallback) Constructor for Property.
| |
| addProperties | back to summary |
|---|---|
| protected void addProperties(Properties props) iterate through a set of properties, resolve them then assign them
| |
| addProperty | back to summary |
|---|---|
| protected void addProperty(String n, String v) add a name value pair to the project property set | |
| addProperty | back to summary |
|---|---|
| protected void addProperty(String n, Object v) add a name value pair to the project property set | |
| addText | back to summary |
|---|---|
| public void addText(String msg) Set a (multiline) property as nested text.
| |
| createClasspath | back to summary |
|---|---|
| public Path createClasspath() The classpath to use when looking up a resource.
| |
| execute | back to summary |
|---|---|
| public void execute() throws BuildException Overrides org. set the property in the project to the value. if the task was give a file, resource, env or runtime attribute here is where it is loaded
| |
| getClasspath | back to summary |
|---|---|
| public Path getClasspath() Get the classpath used when looking up a resource.
| |
| getEnvironment | back to summary |
|---|---|
| public String getEnvironment() Get the environment attribute.
| |
| getFile | back to summary |
|---|---|
| public File getFile() Get the file attribute.
| |
| getName | back to summary |
|---|---|
| public String getName() Get the property name.
| |
| getPrefix | back to summary |
|---|---|
| public String getPrefix() Get the prefix attribute.
| |
| getPrefixValues | back to summary |
|---|---|
| public boolean getPrefixValues() Whether to apply the prefix when expanding properties on the right hand side of a properties file as well.
| |
| getRefid | back to summary |
|---|---|
| public Reference getRefid() Get the refid attribute.
| |
| getResource | back to summary |
|---|---|
| public String getResource() Get the resource attribute.
| |
| getRuntime | back to summary |
|---|---|
| public String getRuntime() Get the runtime attribute.
| |
| getUrl | back to summary |
|---|---|
| public URL getUrl() Get the url attribute.
| |
| getValue | back to summary |
|---|---|
| public String getValue() Get the property value.
| |
| internalSetValue | back to summary |
|---|---|
| private void internalSetValue(Object value) | |
| loadEnvironment | back to summary |
|---|---|
| protected void loadEnvironment(String prefix) load the environment values
| |
| loadFile | back to summary |
|---|---|
| protected void loadFile(File file) throws BuildException load properties from a file
| |
| loadProperties | back to summary |
|---|---|
| private void loadProperties(Properties props, InputStream is, boolean isXml) throws IOException Loads the properties defined in the InputStream into the given property. On Java5+ it supports reading from XML based property definition.
| |
| loadResource | back to summary |
|---|---|
| protected void loadResource(String name) load properties from a resource in the current classpath
| |
| loadRuntime | back to summary |
|---|---|
| protected void loadRuntime(String prefix) load the runtime values
| |
| loadUrl | back to summary |
|---|---|
| protected void loadUrl(URL url) throws BuildException load properties from a url
| |
| resolveAllProperties | back to summary |
|---|---|
| private void resolveAllProperties(Map<String, Object> props) throws BuildException resolve properties inside a properties hashtable | |
| setBasedir | back to summary |
|---|---|
| public void setBasedir(File basedir) Sets 'basedir' attribute.
| |
| setClasspath | back to summary |
|---|---|
| public void setClasspath(Path classpath) The classpath to use when looking up a resource.
| |
| setClasspathRef | back to summary |
|---|---|
| public void setClasspathRef(Reference r) the classpath to use when looking up a resource, given as reference to a <path> defined elsewhere
| |
| setEnvironment | back to summary |
|---|---|
| public void setEnvironment(String env) Prefix to use when retrieving environment variables. Thus if you specify environment="myenv" you will be able to access OS-specific environment variables via property names "myenv.PATH" or "myenv.TERM". Note that if you supply a property name with a final "." it will not be doubled. ie environment="myenv." will still allow access of environment variables through "myenv.PATH" and "myenv.TERM". This functionality is currently only implemented on select platforms. Feel free to send patches to increase the number of platforms this functionality is supported on ;). Note also that properties are case sensitive, even if the environment variables on your operating system are not, e.g. it will be ${env.Path} not ${env.PATH} on Windows 2000.
| |
| setFile | back to summary |
|---|---|
| public void setFile(File file) Filename of a property file to load.
| |
| setLocation | back to summary |
|---|---|
| public void setLocation(File location) Sets the property to the absolute filename of the given file. If the value of this attribute is an absolute path, it is left unchanged (with / and \ characters converted to the current platforms conventions). Otherwise it is taken as a path relative to the project's basedir and expanded.
| |
| setName | back to summary |
|---|---|
| public void setName(String name) The name of the property to set.
| |
| setPrefix | back to summary |
|---|---|
| public void setPrefix(String prefix) Prefix to apply to properties loaded using
| |
| setPrefixValues | back to summary |
|---|---|
| public void setPrefixValues(boolean b) Whether to apply the prefix when expanding properties on the right hand side of a properties file as well.
| |
| setRefid | back to summary |
|---|---|
| public void setRefid(Reference ref) Sets a reference to an Ant datatype declared elsewhere. Only yields reasonable results for references PATH like structures or properties.
| |
| setRelative | back to summary |
|---|---|
| public void setRelative(boolean relative) Sets 'relative' attribute.
| |
| setResource | back to summary |
|---|---|
| public void setResource(String resource) The resource name of a property file to load
| |
| setRuntime | back to summary |
|---|---|
| public void setRuntime(String prefix) Prefix to use when retrieving Runtime properties. Properties Note that if you supply a prefix name with a final "." it will not be doubled. ie runtime="myrt." will still allow access of property through "myrt.availableProcessors" and "myrt.freeMemory". The property values are snapshots taken at the point in time
when the
| |
| setUrl | back to summary |
|---|---|
| public void setUrl(URL url) The url from which to load properties.
| |
| setUserProperty | back to summary |
|---|---|
| public void setUserProperty(boolean userProperty)
Deprecated since 1.5.x. This was never a supported feature and has been deprecated without replacement.
| |
| setValue | back to summary |
|---|---|
| public void setValue(Object value) Set the value of the property.
| |
| setValue | back to summary |
|---|---|
| public void setValue(String value) Set the value of the property as a String.
| |
| toString | back to summary |
|---|---|
| public String toString() Overrides java. get the value of this property | |