[JBoss JIRA] (FORGE-2648) XML Attribute not "saved" in the pom.xml
by Clement Escoffier (JIRA)
[ https://issues.jboss.org/browse/FORGE-2648?page=com.atlassian.jira.plugin... ]
Clement Escoffier commented on FORGE-2648:
------------------------------------------
June 15th is perfect, just in time to publish the addon before the summit.
> 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)
8 years, 8 months
[JBoss JIRA] (FORGE-2648) XML Attribute not "saved" in the pom.xml
by George Gastaldi (JIRA)
[ https://issues.jboss.org/browse/FORGE-2648?page=com.atlassian.jira.plugin... ]
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)
8 years, 8 months
[JBoss JIRA] (FORGE-2648) XML Attribute not "saved" in the pom.xml
by George Gastaldi (JIRA)
[ https://issues.jboss.org/browse/FORGE-2648?page=com.atlassian.jira.plugin... ]
George Gastaldi commented on FORGE-2648:
----------------------------------------
Great! The next release (3.2.1.Final) is on June 15th, but we can do that sooner if needed
> 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)
8 years, 8 months
[JBoss JIRA] (FORGE-2648) XML Attribute not "saved" in the pom.xml
by Clement Escoffier (JIRA)
[ https://issues.jboss.org/browse/FORGE-2648?page=com.atlassian.jira.plugin... ]
Clement Escoffier edited comment on FORGE-2648 at 5/20/16 4:42 AM:
-------------------------------------------------------------------
The fix works !
The `pom.xml` file contains the attributes with the snapshots version (freshly built) of forge.
Expect a vert.x addon as soon as there is a new forge release.
Thanks !
was (Author: clement_escoffier):
The fix works !
The `pom.xml` file contains the attributes with the snapshots version (freshly built) of forge.
Thanks !
> 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)
8 years, 8 months
[JBoss JIRA] (FORGE-2648) XML Attribute not "saved" in the pom.xml
by Clement Escoffier (JIRA)
[ https://issues.jboss.org/browse/FORGE-2648?page=com.atlassian.jira.plugin... ]
Clement Escoffier commented on FORGE-2648:
------------------------------------------
The fix works !
The `pom.xml` file contains the attributes with the snapshots version (freshly built) of forge.
Thanks !
> 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)
8 years, 8 months
[JBoss JIRA] (FORGE-2648) XML Attribute not "saved" in the pom.xml
by George Gastaldi (JIRA)
[ https://issues.jboss.org/browse/FORGE-2648?page=com.atlassian.jira.plugin... ]
George Gastaldi commented on FORGE-2648:
----------------------------------------
I´ve pushed a fix, will push the tests later.
Could you give it a try with the latest master? Just run a {{mvn clean install -DskipTests}} and unzip the forge distribution ZIP under dist/target.
I appreciate your feedback.
> 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)
8 years, 8 months
[JBoss JIRA] (ROASTER-50) Roaster tries to add Generic Type Variable as a java import
by Elis Edlund (JIRA)
[ https://issues.jboss.org/browse/ROASTER-50?page=com.atlassian.jira.plugin... ]
Elis Edlund edited comment on ROASTER-50 at 5/20/16 2:15 AM:
-------------------------------------------------------------
Here's some very simple unit test that does not work right now:
{code:java}
@Test
public void testSetReturnTypeWithGenerics() {
JavaClassSource source = Roaster.create(JavaClassSource.class);
MethodSource<JavaClassSource> srcMethod = source.addMethod();
srcMethod.setName("name");
srcMethod.setPublic();
srcMethod.addTypeVariable("T");
srcMethod.setReturnType("List");
assertTrue(srcMethod.toString().contains("public <T>List name()")); //shouldn't it be a space between <T> and List?
srcMethod.setReturnType("List<T>");
assertTrue(srcMethod.toString().contains("public <T> List<T> name()"));
}
@Test
public void testTransferableReturnType() {
JavaClassSource source = Roaster.create(JavaClassSource.class);
MethodSource<JavaClassSource> srcMethod = source.addMethod();
srcMethod.setName("name");
srcMethod.addTypeVariable("T");
srcMethod.setReturnType("List");
JavaClassSource dest = Roaster.create(JavaClassSource.class);
MethodSource<JavaClassSource> destMethod = source.addMethod();
destMethod.setReturnType(srcMethod.getReturnType()); //not compiling, cast will still fail!
assertTrue(destMethod.toString().contains("List<T> name()"));
}
@Test
public void testTransferableReturnTypeString() {
JavaClassSource source = Roaster.create(JavaClassSource.class);
MethodSource<JavaClassSource> srcMethod = source.addMethod();
srcMethod.setName("name");
srcMethod.addTypeVariable("T");
srcMethod.setReturnType("List<T>");
JavaClassSource dest = Roaster.create(JavaClassSource.class);
MethodSource<JavaClassSource> destMethod = source.addMethod();
destMethod.setReturnType(srcMethod.getReturnType().getQualifiedNameWithGenerics());
assertTrue(destMethod.toString().contains("List<T> name()"));
}
{code}
it would look very similar for parameters also,
was (Author: elis.edlund):
Here's some very simple unit test that does not work right now:
{code:java}
@Test
public void testSetReturnTypeWithGenerics() {
JavaClassSource source = Roaster.create(JavaClassSource.class);
MethodSource<JavaClassSource> srcMethod = source.addMethod();
srcMethod.setName("name");
srcMethod.setPublic();
srcMethod.addTypeVariable("T");
srcMethod.setReturnType("List");
assertTrue(srcMethod.toString().contains("public <T>List name()")); //shouldn't it be a space between <T> and List?
srcMethod.setReturnType("List<T>");
assertTrue(srcMethod.toString().contains("public <T> List<T> name()"));
}
@Test
public void testTransferableReturnType() {
JavaClassSource source = Roaster.create(JavaClassSource.class);
MethodSource<JavaClassSource> srcMethod = source.addMethod();
srcMethod.setName("name");
srcMethod.addTypeVariable("T");
srcMethod.setReturnType("List");
JavaClassSource dest = Roaster.create(JavaClassSource.class);
MethodSource<JavaClassSource> destMethod = source.addMethod();
destMethod.setReturnType(srcMethod.getReturnType()); //not compiling, cast will still fail!
assertTrue(destMethod.toString().contains("List<T> name()"));
}
@Test
public void testTransferableReturnTypeString() {
JavaClassSource source = Roaster.create(JavaClassSource.class);
MethodSource<JavaClassSource> srcMethod = source.addMethod();
srcMethod.setName("name");
srcMethod.addTypeVariable("T");
srcMethod.setReturnType("List<T>");
JavaClassSource dest = Roaster.create(JavaClassSource.class);
MethodSource<JavaClassSource> destMethod = source.addMethod();
destMethod.setReturnType(srcMethod.getReturnType().getQualifiedNameWithGenerics());
assertTrue(destMethod.toString().contains("List<T> name()"));
}
{code}
> Roaster tries to add Generic Type Variable as a java import
> -----------------------------------------------------------
>
> Key: ROASTER-50
> URL: https://issues.jboss.org/browse/ROASTER-50
> Project: Roaster
> Issue Type: Bug
> Reporter: Yusuf Iskenderoglu
> Fix For: 2.x Future
>
>
> When you create a new Method with a Type variable, you cannot use it in a parameter, it crashes with:
> {code}
> Exception in thread "main" java.lang.IllegalArgumentException: Cannot import class without a package [T]
> at org.jboss.forge.roaster.model.impl.AbstractJavaSource.addImport(AbstractJavaSource.java:172)
> at org.jboss.forge.roaster.model.impl.MethodImpl.addParameter(MethodImpl.java:682)
> at de.check24.finance.baufi.roast.main.Roast.parse(Roast.java:225)
> {code}
> This is due to AbstractJavaSource.requiresImport() not returning false for type variables.
> Can you consider this for the next release, too?
> Thanks!
> Related To: ROASTER-48
--
This message was sent by Atlassian JIRA
(v6.4.11#64026)
8 years, 8 months
[JBoss JIRA] (ROASTER-50) Roaster tries to add Generic Type Variable as a java import
by Elis Edlund (JIRA)
[ https://issues.jboss.org/browse/ROASTER-50?page=com.atlassian.jira.plugin... ]
Elis Edlund commented on ROASTER-50:
------------------------------------
Here's some very simple unit test that does not work right now:
{code:java}
@Test
public void testSetReturnTypeWithGenerics() {
JavaClassSource source = Roaster.create(JavaClassSource.class);
MethodSource<JavaClassSource> srcMethod = source.addMethod();
srcMethod.setName("name");
srcMethod.setPublic();
srcMethod.addTypeVariable("T");
srcMethod.setReturnType("List");
assertTrue(srcMethod.toString().contains("public <T>List name()")); //shouldn't it be a space between <T> and List?
srcMethod.setReturnType("List<T>");
assertTrue(srcMethod.toString().contains("public <T> List<T> name()"));
}
@Test
public void testTransferableReturnType() {
JavaClassSource source = Roaster.create(JavaClassSource.class);
MethodSource<JavaClassSource> srcMethod = source.addMethod();
srcMethod.setName("name");
srcMethod.addTypeVariable("T");
srcMethod.setReturnType("List");
JavaClassSource dest = Roaster.create(JavaClassSource.class);
MethodSource<JavaClassSource> destMethod = source.addMethod();
destMethod.setReturnType(srcMethod.getReturnType()); //not compiling, cast will still fail!
assertTrue(destMethod.toString().contains("List<T> name()"));
}
@Test
public void testTransferableReturnTypeString() {
JavaClassSource source = Roaster.create(JavaClassSource.class);
MethodSource<JavaClassSource> srcMethod = source.addMethod();
srcMethod.setName("name");
srcMethod.addTypeVariable("T");
srcMethod.setReturnType("List<T>");
JavaClassSource dest = Roaster.create(JavaClassSource.class);
MethodSource<JavaClassSource> destMethod = source.addMethod();
destMethod.setReturnType(srcMethod.getReturnType().getQualifiedNameWithGenerics());
assertTrue(destMethod.toString().contains("List<T> name()"));
}
{code}
> Roaster tries to add Generic Type Variable as a java import
> -----------------------------------------------------------
>
> Key: ROASTER-50
> URL: https://issues.jboss.org/browse/ROASTER-50
> Project: Roaster
> Issue Type: Bug
> Reporter: Yusuf Iskenderoglu
> Fix For: 2.x Future
>
>
> When you create a new Method with a Type variable, you cannot use it in a parameter, it crashes with:
> {code}
> Exception in thread "main" java.lang.IllegalArgumentException: Cannot import class without a package [T]
> at org.jboss.forge.roaster.model.impl.AbstractJavaSource.addImport(AbstractJavaSource.java:172)
> at org.jboss.forge.roaster.model.impl.MethodImpl.addParameter(MethodImpl.java:682)
> at de.check24.finance.baufi.roast.main.Roast.parse(Roast.java:225)
> {code}
> This is due to AbstractJavaSource.requiresImport() not returning false for type variables.
> Can you consider this for the next release, too?
> Thanks!
> Related To: ROASTER-48
--
This message was sent by Atlassian JIRA
(v6.4.11#64026)
8 years, 8 months
[JBoss JIRA] (FORGE-2648) XML Attribute not "saved" in the pom.xml
by George Gastaldi (JIRA)
[ https://issues.jboss.org/browse/FORGE-2648?page=com.atlassian.jira.plugin... ]
George Gastaldi updated FORGE-2648:
-----------------------------------
Description:
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.
was:
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.
> 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
> 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)
8 years, 8 months