]
George Gastaldi updated FORGE-2273:
-----------------------------------
Priority: Minor (was: Major)
MavenFacet - Write properties sorted A..Z
-----------------------------------------
Key: FORGE-2273
URL:
https://issues.jboss.org/browse/FORGE-2273
Project: Forge
Issue Type: Feature Request
Components: Build Tools - Maven
Affects Versions: 2.15.0.Final
Reporter: Claus Ibsen
Priority: Minor
Fix For: 2.x Future
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:
{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);
{code}
Which then generates the following in the pom.xml
{code}
<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>
{code}
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.