@Incubating @CacheableTask public class WriteProperties extends DefaultTask
Properties in a way that the results can be expected to be reproducible.
There are a number of differences compared to how properties are stored:
Like with Properties, Unicode characters are escaped when using the
default Latin-1 (ISO-8559-1) encoding.
Properties.store(OutputStream, String)Task.NamerTASK_ACTION, TASK_DEPENDS_ON, TASK_DESCRIPTION, TASK_GROUP, TASK_NAME, TASK_OVERWRITE, TASK_TYPE| Constructor and Description |
|---|
WriteProperties() |
| Modifier and Type | Method and Description |
|---|---|
String |
getComment()
Returns the optional comment to add at the beginning of the properties file.
|
String |
getEncoding()
Returns the encoding used to write the properties file.
|
String |
getLineSeparator()
Returns the line separator to be used when creating the properties file.
|
File |
getOutputFile()
Returns the output file to write the properties to.
|
Map<String,String> |
getProperties()
Returns an immutable view of properties to be written to the properties file.
|
void |
properties(Map<String,Object> properties)
Adds multiple properties to be written to the properties file.
|
void |
property(String name,
Object value)
Adds a property to be written to the properties file.
|
void |
setComment(String comment)
Sets the optional comment to add at the beginning of the properties file.
|
void |
setEncoding(String encoding)
Sets the encoding used to write the properties file.
|
void |
setLineSeparator(String lineSeparator)
Sets the line separator to be used when creating the properties file.
|
void |
setOutputFile(File outputFile)
Sets the output file to write the properties to.
|
void |
setOutputFile(Object outputFile)
Sets the output file to write the properties to.
|
void |
setProperties(Map<String,Object> properties)
Sets all properties to be written to the properties file replacing any existing properties.
|
void |
writeProperties() |
newInputDirectory, newInputFile, newOutputDirectory, newOutputFileaddValidator, appendParallelSafeAction, compareTo, configure, deleteAllActions, dependsOn, dependsOnTaskDidWork, doFirst, doFirst, doFirst, doLast, doLast, doLast, execute, finalizedBy, getActions, getAnt, getAsDynamicObject, getConvention, getDependsOn, getDescription, getDestroyables, getDidWork, getEnabled, getExecuter, getExtensions, getFinalizedBy, getGroup, getIdentityPath, getImpliesSubProjects, getInputs, getLocalState, getLogger, getLogging, getMustRunAfter, getName, getOnlyIf, getOutputs, getPath, getProject, getServices, getShouldRunAfter, getStandardOutputCapture, getState, getTaskActions, getTaskDependencies, getTemporaryDir, getTemporaryDirFactory, getValidators, hasProperty, injectIntoNewInstance, isEnabled, isHasCustomActions, leftShift, mustRunAfter, onlyIf, onlyIf, prependParallelSafeAction, property, setActions, setDependsOn, setDescription, setDidWork, setEnabled, setExecuter, setFinalizedBy, setGroup, setImpliesSubProjects, setMustRunAfter, setOnlyIf, setOnlyIf, setProperty, setShouldRunAfter, shouldRunAfter, toString@Incubating @Input public Map<String,String> getProperties()
public void setProperties(Map<String,Object> properties)
properties(Map),
property(String, Object)@Incubating public void property(String name, Object value)
A property's value will be coerced to a String with String#valueOf(Object) or a
Callable returning a value to be coerced into a String.
Values are not allowed to be null.
name - Name of the propertyvalue - Value of the property@Incubating public void properties(Map<String,Object> properties)
This is a convenience method for calling property(String, Object) multiple times.
properties - Properties to be addedproperty(String, Object)@Input public String getLineSeparator()
public void setLineSeparator(String lineSeparator)
@Input @Optional public String getComment()
public void setComment(String comment)
@Input public String getEncoding()
public void setEncoding(String encoding)
@OutputFile public File getOutputFile()
public void setOutputFile(File outputFile)
public void setOutputFile(Object outputFile)
public void writeProperties()
throws IOException
IOException