public class PropertiesPlugin
extends java.lang.Object
implements org.gradle.api.Plugin<org.gradle.api.Project>
This plugin can be useful when a complicated repository holds multiple
unrelated Gradle builds that should share certain properties, such as for
example a version string. In this case a version.properties
file can be added to the repository root and the plugin can be used to
apply the properties it contains to the Gradle projects in the repository.
| Modifier and Type | Field and Description |
|---|---|
static java.lang.String |
DEFAULT_PROPERTIES_PATH_DELIMITER
The default path delimiter for the paths listing - comma.
|
java.lang.String |
delimiter
The delimiter configured for the plugin.
|
static java.lang.String |
PROPERTIES_PATH_DELIMITER_PROPERTY
The path delimiter used for the paths listing.
|
static java.lang.String |
PROPERTIES_PATHS_PROPERTY
The name of the property that defines the location of the properties file to read.
|
| Constructor and Description |
|---|
PropertiesPlugin() |
| Modifier and Type | Method and Description |
|---|---|
void |
apply(org.gradle.api.Project project)
Applies the plug-in to the parameter project.
|
public static final java.lang.String DEFAULT_PROPERTIES_PATH_DELIMITER
public static final java.lang.String PROPERTIES_PATH_DELIMITER_PROPERTY
public static final java.lang.String PROPERTIES_PATHS_PROPERTY
public java.lang.String delimiter
public void apply(org.gradle.api.Project project)
The location of the property file is defined as the value of the
project property com.brambolt.gradle.properties.path.
A properties file will be located and parsed, and every property in file will be set on the project. If the file is not found, an exception is thrown.
If the files defines one or more properties that the project already has values for, an exception is thrown. In case of built-in Gradle project properties with default values, an exception is thrown if the project has a non-default value for that property.
Built-in project properties that are explicitly supported by the plugin
include group, status, version. In
general any project property that defaults to null or the
empty string will be handled correctly, and the unspecified
version value is also correctly understood.
The properties path can be absolute, in which case the corresponding file will be parsed, or relative, in which case the plugin first attempts to resolve the path relative to the project directory, and then recurses up towards the root directory until the path is successfully resolved or the root directory has been checked.
The properties path can be a comma-delimited list, in which case every listed path must be successfully resolved. The files are applied in the order listed. If a subsequent file redefines a property an exception is thrown.
apply in interface org.gradle.api.Plugin<org.gradle.api.Project>project - The project to apply the plug-in to