Skip to main content

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

Fred, thanks for response.

About 1st issue, I need to have control of the EAR name in my real project because it contains EJBs that are consumed by other clients and they lookup for the EJBs using a name like <EarName>/<EJBName>/Remote and this EarName is known by the clients. So when I bulid my application, the EAR must be deployed with the same name the clients use to lookup EJBs. As I can't do it from M2E, the workaround I'm doing is "way too around", I mean... at the moment, I'm running Maven CLI to make it work.

I really don't know much about wtp implementation, but as an user perspective, I think wtp uses the project name as the final ear name. 

So, if it is true, I don't know if it would solve (and if it solves, I don't know if it would be the best solution), but maybe if M2E used ${project.build.finalName} instead of using artifactId to name the project (from the "New Maven Project" or the "Import Existing Maven Project" feature) it would achieve the goal.

About 2nd issue, I opened a JIRA issue [1] with a basic description that just points to this thread. Thought it would be better than duplicating information there. (but while I'm writing right now I've just seen that you already edited the JIRA issue putting all information there hehe)

[1] https://issues.sonatype.org/browse/MECLIPSEWTP-124

Regards,

Rafael Vanderlei

On Thu, May 12, 2011 at 5:53 PM, Fred Bricon <fbricon@xxxxxxxxx> wrote:
Rafael,

1st issue is both a bug in m2e-wtp and in WTP : m2e-wtp doesn't set the project's deploy-name according to finalName, but even if it did, then WTP would ignore it anyway : https://bugs.eclipse.org/bugs/show_bug.cgi?id=340918
There *might* be some workaround depending on the reasons why you need a specific ear name deployed on the server, so it would help if you could describe your use case.

2nd issue is not implemented. Please open a JIRA issue at https://issues.sonatype.org/browse/MECLIPSEWTP and attach your sample projects there.
It should be pretty straightforward to implement, now that resource filtering is done for web projects.

Regards,

Fred Bricon

2011/5/12 Rafael Vanderlei <rafaelvanderlei@xxxxxxxxx>
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.

_______________________________________________
m2e-users mailing list
m2e-users@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/m2e-users




--
"Have you tried turning it off and on again" - The IT Crowd

_______________________________________________
m2e-users mailing list
m2e-users@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/m2e-users



Back to the top