[forge-issues] [JBoss JIRA] (FORGE-2648) XML Attribute not "saved" in the pom.xml

George Gastaldi (JIRA) issues at jboss.org
Fri May 20 11:15:03 EDT 2016


     [ https://issues.jboss.org/browse/FORGE-2648?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

George Gastaldi closed FORGE-2648.
----------------------------------
    Resolution: Done


> XML Attribute not "saved" in the pom.xml
> ----------------------------------------
>
>                 Key: FORGE-2648
>                 URL: https://issues.jboss.org/browse/FORGE-2648
>             Project: Forge
>          Issue Type: Bug
>          Components: Build Tools - Maven
>    Affects Versions: 3.2.0.Final
>            Reporter: Clement Escoffier
>            Assignee: George Gastaldi
>             Fix For: 3.2.1.Final
>
>
> I've an addon that generates a Maven plugin configuration for the maven-shade-plugin. This plugin configuration requires XML attributes:
> {code:xml}
> <transformer implementation="org.apache.maven.plugins.shade.resource.AppendingTransformer">
> <resource>META-INF/services/io.vertx.core.spi.VerticleFactory</resource></transformer>
> </transformers>
> {code}
> I create a configuration object that should contain these attributes:
> {code:java}
> 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;
>   }
> {code}
> 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:
> {code:java}
>  builder.addExecution(ExecutionBuilder.create().addGoal("shade").setPhase("package").setId("package-fat-jar").setConfig(configuration));
> pluginFacet.addPlugin(builder);
> {code}
> and in the `pom.xml` file I got only:
> {code:xml}
>     <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>
> {code}
> It was working with Forge 2.20.1.Final.



--
This message was sent by Atlassian JIRA
(v6.4.11#64026)


More information about the forge-issues mailing list