Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[m2e-users] Problem with m2e and EAR resource filtering

Hi everyone.

I found what it seems to be a bug in M2Eclipse (actually perhaps there are two bugs) and I created a project (attached on the mail) to help you reproduce the error in order to fix it.

In summary, the "bugs" are:

1. M2Eclipse seems to ignore ${project.build.finalName} to name the EAR published in the server.
2. M2Eclipse seems to ignore <filtering>true</filtering> configured in the maven-ear-plugin

PS.: I´m using Eclipse Helios, m2e-core 0.12.1.20110112-1712 and m2e-wtp 0.11.1.201011.08-1810 (I know it is not the latest m2e-wtp release, but I looked at release notes of the latest version and I could not find any fixes related to these problems)

The project structure is as follows:

- m2ewtp-ear-source-filtering-bug/
--- pom.xml
--- blank-ejb-module/
------ pom.xml
------ src/main/resources/META-INF/
--------- MANIFEST.MF
--------- ejb-jar.xml
--- ear-module/
------ pom.xml
------ src/main/application/META-INF/
--------- application.xml
--------- jboss-service.xml

I created blank-ejb-module just to insert it into ear-module/src/main/application/META-INF/application.xml (just because its DTD requires a module element)

In ear-module 's pom.xml I have this:

<project>
    ...

    <properties>
        <my.custom.mbean.attribute.value>MBean Attribute Value</my.custom.mbean.attribute.value>
    </properties>

    <build>
   
        <finalName>EarName</finalName>

        <plugins>
            <plugin>
                <artifactId>maven-ear-plugin</artifactId>
                <version>2.5</version>
                <configuration>
                    <filtering>true</filtering>
                    <modules>
                        <ejbModule>
                            <groupId>${project.groupId}</groupId>
                            <artifactId>blank-ejb-module</artifactId>
                        </ejbModule>
                    </modules>
                </configuration>
            </plugin>
        </plugins>
    </build>

    ...
</project>

While in src/main/application/META-INF/jboss-service.xml I have this:

<?xml version="1.0" encoding="UTF-8"?>
<server>
    <mbean name="mbeanName" code="fully.qualified.name">
        <attribute name="CustomAttribute">${my.custom.mbean.attribute.value}</attribute>
    </mbean>
</server>

When I run ' mvn package ' from CLI I have the expected behavior (Maven generates a EAR file named "EarName.ear" and changes the property ${my.custom.mbean.attribute.value} to "MBean Attribute Value".

But when I use m2e and publish to the server (JBoss in my case), Maven generates a EAR file named "ear-module.ear" and it does not change the value of ${my.custom.mbean.attribute.value}.


Below there are a few descriptions of the files I am attaching to help you understand them:

1. On the file m2ewtp-ear-source-filtering-bug.rar there is the clean Maven project (without Eclipse files, just source and pom files)

2. On the file EAR generated by Maven CLI.rar there is the result of a simple ' mvn package ' that I ran from CLI (and which is the result I would expect from m2e, but it´s failing)

3. On the file EAR generated by M2Eclipse.rar there is the failed result of a simple ' Project > Clean ' followed by ' Server > Publish ' that I ran from Eclipse (and which is the result I was not expecting, as I expected the result in file 2 described above)

So, do you guys have any idea of when this would be fixed and, in the meanwhile, do you have any workaround to this problem?

Thanks and regards,

Rafael Vanderlei.

Attachment: m2ewtp-ear-source-filtering-bug.rar
Description: application/rar

Attachment: EAR generated by Maven CLI.rar
Description: application/rar

Attachment: EAR generated by M2Eclipse.rar
Description: application/rar


Back to the top