Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Adding comments to a POM.xml file through Java

I am using org.apache.maven.model.io.xpp3.MavenXpp3Reader and org.apache.maven.model.io.xpp3.MavenXpp3Writer to perform read and write operations on a POM. I would like to add comments as well. I do not want to process the entire String again and write my logic to insert comments. Is there some other way to insert comments and comment out already present tags?

like image 770
Prasanna Avatar asked Mar 02 '15 19:03

Prasanna


1 Answers

I know this is old but in case anyone else is looking... Comments in any xml file, including the POM in a Maven project are signified with with an exclamation tag

<!--my comment-->

Or an example block commented out

  <!--
  <dependencies>
    <dependency>
      <groupId>com.group</groupId>
      <artifactId>anId</artifactId>
      <version>1.0.0</version>
    </dependency>
  </dependencies>
  -->
like image 55
Neil Avatar answered Oct 25 '22 01:10

Neil