企业🤖AI智能体构建引擎,智能编排和调试,一键部署,支持私有化部署方案 广告
# C.43 IniFileTask The `IniFileTask` is inspired by the [Ant-Contrib IniFile](http://ant-contrib.sourceforge.net/tasks/tasks/inifile.html) and can be used to build and edit .ini files. Unlike the Ant equivalent, it can also read values from different sections of an .ini file and set the retrieved values to specified properties. Table C.49:聽Attributes NameTypeDescriptionDefaultRequired`dest``string`The name of the .ini file to write to. If not specified, the source file will be modified instead.noneNo`haltOnError``boolean`Should the build fail when problems occur?falseNo`source``string`The name of the .ini file to read from. If not specified, the dest file will be used instead.noneNo C.43.1 Supported Nested Tags - `get` Use to read a value from a specific key and section of an .ini file Table C.50:聽Attributes NameTypeDescriptionDefaultRequired`default``String`Value to return if section, property or value are not setn/aNo`section``String`Name of the section.n/aYes`property``String`Name of the key, in the specified section, to readn/aYes`outputproperty``String`Name of the property to set the value ton/aYes - `remove` Use to remove either a specific key or section from an .ini file Table C.51:聽Attributes NameTypeDescriptionDefaultRequired`section``String`Name of the section.n/aYes`property``String`Name of the key to remove. If not specified the entire section is removed.n/aNo - `set` Use to set a key in a section to a specific value Table C.52:聽Attributes NameTypeDescriptionDefaultRequired`section``String`Name of the section.n/aYes`property``String`Name of the key/property.n/aYes`operation``String`The operation to perform on the existing value, which must be numeric. Possible values are "+" and "-", which add and subtract 1, respectively from the existing value. If the value doesn't already exist, the set is not performed, triggering an error.n/aNo`value``String`The new value for the property.n/aNo, if operation is specified. C.43.2 Example ``` <inifile haltonerror="no" dest="${project.basedir}/application/configs/application.ini"> <set section="production" property="buildTimestamp" value="${DSTAMP}${TSTAMP}" /> <set section="production" property="buildNumber" operation="+" /> <remove section="development : staging" /> </inifile> ```