How to write (or overwrite) the following contents:
<dependencies>
<dependency>
<groupId>ged.eprom</groupId>
<artifactId>epromx</artifactId>
<version>${version.to.set}</version>
<classifier>stubjava</classifier>
</dependency>
</dependencies>
into file called pom.xml in the current directory.
I have tried the ant script:
<echo file="pom.xml">
<dependencies>
<dependency>
<groupId>ged.eprom</groupId>
<artifactId>epromx</artifactId>
<version>${version.to.set}</version>
<classifier>stubjava</classifier>
</dependency>
</dependencies>
</echo>
But I obtained the error message:
echo doesn't support the nested "dependencies" element.
You must escape the content with a CDATA tag, that also means that it won't interpret the variable substitution, so I would break it up in three echo statements.
<echo file="pom.xml"><![CDATA[
<dependencies>
<dependency>
<groupId>ged.eprom</groupId>
<artifactId>epromx</artifactId>
<version>]]></echo>
<echo file="pom.xml" append="true">${version.to.set}</echo>
<echo file="pom.xml" append="true"><![CDATA[</version>
<classifier>stubjava</classifier>
</dependency>
</dependencies>
]]> </echo>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With