-
Notifications
You must be signed in to change notification settings - Fork 2
XML Usage
Luiz-Micci edited this page Nov 12, 2024
·
16 revisions
To perform mapping for replacement with XML files, you will need to provide the following fields:
-
file:Relative path to the XML file from the project root. -
query:Within the placeholders tag, provide the XPATH for the XML file attribute that needs to be changed. -
name:Value to be replaced for
Usage example:
- Config
mappings:
- file: pom.xml
placeholders:
- query: /project/groupId
name: Cookiecutter.param.groupId
- query: /project/artifactId
name: Cookiecutter.test.replace.map.artifactId- Before:
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>0.0.0</modelVersion>
<groupId>com.example</groupId>
<artifactId>my-example-maven-plugin</artifactId>
<packaging>maven-plugin</packaging>
<version>0.0.0-SNAPSHOT</version>
<name>my project example</name>
<url>http://maven.apache.org</url>
...- Expected result after running Cookie-Cutter Templater:
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>0.0.0</modelVersion>
<groupId>{{Cookiecutter.param.groupId}}</groupId>
<artifactId>{{Cookiecutter.test.replace.map.artifactId}}</artifactId>
<packaging>maven-plugin</packaging>
<version>0.0.0-SNAPSHOT</version>
<name>my project example</name>
<url>http://maven.apache.org</url>
...