Uploaded image for project: 'Forge'
  1. Forge
  2. FORGE-2273

MavenFacet - Write properties sorted A..Z

    Details

      Description

      We have a custom addon that adds various commands.

      We have a docket setup command that enables docker to a maven project. And for that we set some values in the <properties> section of the maven pom.xml.

      To update and set those, we use the following code:

              // update properties section in pom.xml
              MavenFacet maven = project.getFacet(MavenFacet.class);
              Model pom = maven.getModel();
              Properties properties = pom.getProperties();
              properties.put("docker.registryPrefix", "${env.DOCKER_REGISTRY}/");
              properties.put("docker.from", fromImage);
              properties.put("docker.image", "${docker.registryPrefix}fabric8/${project.artifactId}:${project.version}");
              properties.put("docker.assemblyDescriptorRef", descriptorRef);
              properties.put("docker.port.container.jolokia", "8778");
              if (war) {
                  properties.put("docker.port.container.http", "8080");
              }
      
              // to save then set the model
              maven.setModel(pom);
      

      Which then generates the following in the pom.xml

       <properties>
          <docker.port.container.http>8080</docker.port.container.http>
          <docker.registryPrefix>${env.DOCKER_REGISTRY}/</docker.registryPrefix>
          <docker.image>${docker.registryPrefix}fabric8/${project.artifactId}:${project.version}</docker.image>
          <maven.compiler.target>1.7</maven.compiler.target>
          <docker.port.container.jolokia>8778</docker.port.container.jolokia>
          <docker.from>fabric8/tomcat-8.0</docker.from>
          <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
          <docker.assemblyDescriptorRef>rootWar</docker.assemblyDescriptorRef>
          <maven.compiler.source>1.7</maven.compiler.source>
        </properties>
      

      Notice the order of the properties is "random". It would be great if forge would sort the properties A..Z so they are more human readable.

        Gliffy Diagrams

          Attachments

            Activity

              People

              • Assignee:
                gastaldi George Gastaldi
                Reporter:
                davsclaus Claus Ibsen
              • Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: