-
Bug
-
Resolution: Done
-
Major
-
3.2.0.Final
-
None
I've an addon that generates a Maven plugin configuration for the maven-shade-plugin. This plugin configuration requires XML attributes:
<transformer implementation="org.apache.maven.plugins.shade.resource.AppendingTransformer"> <resource>META-INF/services/io.vertx.core.spi.VerticleFactory</resource></transformer> </transformers>
I create a configuration object that should contain these attributes:
public static Configuration getShadeConfiguration() { PluginElement manifestTransformer = ConfigurationElementBuilder.create() .setName("transformer") .addAttribute("implementation", "org.apache.maven.plugins.shade.resource.ManifestResourceTransformer") .setText("<manifestEntries>" + "<Main-Class>io.vertx.core.Launcher</Main-Class>" + "<Main-Verticle>${verticle.main}</Main-Verticle>" + "</manifestEntries>"); PluginElement appendingTransformer = ConfigurationElementBuilder.create() .setName("transformer") .addAttribute("implementation", "org.apache.maven.plugins.shade.resource.AppendingTransformer") .setText("<resource>META-INF/services/io.vertx.core.spi.VerticleFactory</resource>"); ConfigurationElement transformers = ConfigurationElementBuilder.create().setName("transformers") .addChild(manifestTransformer) .addChild(appendingTransformer); Configuration configuration = ConfigurationBuilder.create(); configuration.addConfigurationElement(ConfigurationElementBuilder.create().setName("outputFile").setText("${project" + ".build.directory}/${project.artifactId}-${project.version}-fat.jar")); configuration.addConfigurationElement(transformers); return configuration; }
But when this configuration is persisted in the Maven `pom.xml` file, the attributes are missing. The rest of the metadata are present.
For completeness here are how is configured the plugin:
builder.addExecution(ExecutionBuilder.create().addGoal("shade").setPhase("package").setId("package-fat-jar").setConfig(configuration)); pluginFacet.addPlugin(builder);
and in the `pom.xml` file I got only:
<plugin> <artifactId>maven-shade-plugin</artifactId> <version>2.3</version> <executions> <execution> <id>package-fat-jar</id> <phase>package</phase> <goals> <goal>shade</goal> </goals> <configuration> <outputFile>${project.build.directory}/${project.artifactId}-${project.version}-fat.jar</outputFile> <transformers> <transformer> <manifestEntries> <Main-Class>io.vertx.core.Launcher</Main-Class> <Main-Verticle>${verticle.main}</Main-Verticle> </manifestEntries> </transformer> <transformer> <resource>META-INF/services/io.vertx.core.spi.VerticleFactory</resource> </transformer> </transformers> </configuration> </execution> </executions> </plugin>
It was working with Forge 2.20.1.Final.
- is caused by
-
FORGE-440 A pom.xml which contains comments loses all of them after Forge operates on it.
- Closed