[Java] pom.xml manual added property is overwritten when a new package is added

Problem description:

When pom.xml is manually amended with project properties (eg. to adjust to use Java 17), when a new package is added, those properties are not kept.

Expected behavior:
Only <dependencies> section of pom.xml should be impacted.

Actual behavior:
For example, if this is the an excerpt of manually edited pom.xml:

<project>
    <properties>
    <java.version>17</java.version>
    <maven.compiler.source>17</maven.compiler.source>
    <maven.compiler.target>17</maven.compiler.target>
    </properties>
  <modelVersion>4.0.0</modelVersion>
  <groupId>mygroupid</groupId>
  <artifactId>myartifactid</artifactId>
  <version>0.0-SNAPSHOT</version>
  <dependencies>
    <dependency>
      <groupId>junit</groupId>
      <artifactId>junit</artifactId>
      <version>4.12</version>
      <type>jar</type>
    </dependency>
....

The user adds hamcrestlibrary using package install feature of the editor. The pom.xml would look like this. Note the <properties> is removed:

<project>
  <modelVersion>4.0.0</modelVersion>
  <groupId>mygroupid</groupId>
  <artifactId>myartifactid</artifactId>
  <version>0.0-SNAPSHOT</version>
  <dependencies>
    <dependency>
      <groupId>junit</groupId>
      <artifactId>junit</artifactId>
      <version>4.12</version>
      <type>jar</type>
    </dependency>
    <dependency>
      <groupId>org.hamcrest</groupId>
      <artifactId>hamcrest-core</artifactId>
      <version>1.3</version>
      <type>jar</type>
    </dependency>
...

Steps to reproduce:

  1. Amend pom.xml <project> with <properties>.
  2. Install a new package.
  3. Verify that <properties> has disappeared from pom.xml.

Bug appears at this link:

Browser/OS/Device:
N/A