Maven 2.x Ear Plugin

Autodetect "Client Application" modules and "EJB3" modules.

Details

  • Type: New Feature New Feature
  • Status: Closed Closed
  • Priority: Major Major
  • Resolution: Duplicate
  • Affects Version/s: 2.2
  • Fix Version/s: 2.6
  • Component/s: None
  • Labels:
    None
  • Number of attachments :
    0

Description

The J2EE 1.4 specification know the modules type "EJB", "WEB", "RAR" and "Client Application".
The EAR plugin currently supports the autodetection of "EJB", "WEB" and "RAR".
As a result, the EAR plugin automatically creates an application.xml file containing <module> entries using the corresponding type, without the need to add <module> entries to the pom.

Unfortunately this is not working with "Client Application" modules and "EJB3" modules.
To have a client module's corresponding <java> tag get added to the application.xml file, the developer has to add it to the pom.xml manually, what is not nice. Actually it would be easy for the EAR plugin to do that automatically: It just needs to check whether each of the dependencies named in the pom.xml file has a ".jar" extension AND contains a file called "/META-INF/client-application.xml" (check J2EE 1.4 specification chapter 9 on details). If such a file is found, the dependency is a "Client Application" and in turn the EAR plugin has to add a "<java>" tag to the application.xml file.

Also, the support of "EJB3" modules is not working, since they do not necessarily have a "/META-INF/ejb-jar.xml" file contained, which would be needed to discriminate "utility JARs" from "EJB3 JARs" (as the distinction of "utility JARs" from "Client Application JARs" can be done as described above using the existence of the "/META-INF/client-application.xml" file). Nevertheless, there should be a means of automatic detection of EJB3 modules for automatic generation of <module> entries in application.xml. A possible way to solve that could be to analyze the content of each file with a .jar extension: As soon as at least one class is contained that is annotated as @Stateful, @Stateless, @Entity or @MessageDriven, or as soon as a file named "/META-INF/ejb-jar.xml" is found in the jar, the definitively is an EJB module and in turn the EAR module has to add a <ejb> tag to the application.xml file. Actually this will slow down detection of module types, but on the other hand the user decided to use the automation instead of manually adding <module> entries, so he will accept the performance penalty.

Issue Links

Activity

Hide
Stephane Nicoll added a comment -

OK for your first comment regarding client-application.

For the other comment it has nothing to do with the EAR plugin. If you have an EJB3 artifact declared with an 'ejb' dependency it will work out of the book. Don't expect maven to recognize ejb3 modules if you define them as simple jar. However, if the ejb plugin prevents you from building an Ejb if no ejb-jar.xml is found, please raise an issue in this plugin.

Show
Stephane Nicoll added a comment - OK for your first comment regarding client-application. For the other comment it has nothing to do with the EAR plugin. If you have an EJB3 artifact declared with an 'ejb' dependency it will work out of the book. Don't expect maven to recognize ejb3 modules if you define them as simple jar. However, if the ejb plugin prevents you from building an Ejb if no ejb-jar.xml is found, please raise an issue in this plugin.
Hide
darren hartford added a comment -

wow - nov 2006? This would be nice, and help avoid the dreaded "Artifact[ejb3:*.*.*] is not a dependency of the project."

Show
darren hartford added a comment - wow - nov 2006? This would be nice, and help avoid the dreaded "Artifact[ejb3:*.*.*] is not a dependency of the project."
Hide
darren hartford added a comment -

ejb3module should be removed from documentation if this is true:
http://java2.5341.com/msg/224841.html

Is the auto-detect dependent on defining the <type>ejb</type>? By convention (i.e. maven's favorite word) you usually do not need to fill in the <type> unless it is really necessary to differetiate.

Shouldn't the auto-detect be able to go by the pom.xml of that project, instead of relying on defining <type> in the dependencies section of the EAR project?

Show
darren hartford added a comment - ejb3module should be removed from documentation if this is true: http://java2.5341.com/msg/224841.html Is the auto-detect dependent on defining the <type>ejb</type>? By convention (i.e. maven's favorite word) you usually do not need to fill in the <type> unless it is really necessary to differetiate. Shouldn't the auto-detect be able to go by the pom.xml of that project, instead of relying on defining <type> in the dependencies section of the EAR project?
Hide
David Wallace Croft added a comment -

I reported it as a bug in the documentation:
http://jira.codehaus.org/browse/MNGSITE-70

Show
David Wallace Croft added a comment - I reported it as a bug in the documentation: http://jira.codehaus.org/browse/MNGSITE-70
Hide
Brian Leathem added a comment -

It just needs to check whether each of the dependencies named in the pom.xml file has a ".jar" extension AND contains a file called "/META-INF/client-application.xml" (check J2EE 1.4 specification chapter 9 on details). If such a file is found, the dependency is a "Client Application" and in turn the EAR plugin has to add a "<java>" tag to the application.xml file.

This issue is marked as fixed, but I am not getting the quoted behaviour. I have an ear project that has a dependency on a jar that contains an "application-client.xml" file (I also tried using the filename "client-application.xml" as in the above quote). The ear's application.xml file has entries for the ejb and web modules, but not for the application client module. This is for a JavaEE 5 project.

I am using maven 2.10. So should this issue still be open? Is there some other way of including my application-client in the ear file?

Thanks,
Brian Leathem

Show
Brian Leathem added a comment -
It just needs to check whether each of the dependencies named in the pom.xml file has a ".jar" extension AND contains a file called "/META-INF/client-application.xml" (check J2EE 1.4 specification chapter 9 on details). If such a file is found, the dependency is a "Client Application" and in turn the EAR plugin has to add a "<java>" tag to the application.xml file.
This issue is marked as fixed, but I am not getting the quoted behaviour. I have an ear project that has a dependency on a jar that contains an "application-client.xml" file (I also tried using the filename "client-application.xml" as in the above quote). The ear's application.xml file has entries for the ejb and web modules, but not for the application client module. This is for a JavaEE 5 project. I am using maven 2.10. So should this issue still be open? Is there some other way of including my application-client in the ear file? Thanks, Brian Leathem
Hide
Stephane Nicoll added a comment -

Where do you see it's fixed exactly? See on the left panel (open)

Show
Stephane Nicoll added a comment - Where do you see it's fixed exactly? See on the left panel (open)
Hide
Brian Leathem added a comment -

Thanks, I now see that the status is still: Open.

I was looking in the comments (All) where it said:

Stephane Nicoll made changes - 22/Feb/09 03:43 AM
Fix Version/s 2.3.2 [ 13023 ]
Fix Version/s 2.4 [ 14487 ]

Which I interpreted as meaning it was supposed to be fixed in version 2.4. I guess I misunderstood.

I've added my vote to the issue, as I'm working around this by manually writing the application.xml file for my ear. This is un-ideal, as I have to remember to edit it every time I do a release (since the version numbers change).

Show
Brian Leathem added a comment - Thanks, I now see that the status is still: Open. I was looking in the comments (All) where it said:
Stephane Nicoll made changes - 22/Feb/09 03:43 AM Fix Version/s 2.3.2 [ 13023 ] Fix Version/s 2.4 [ 14487 ]
Which I interpreted as meaning it was supposed to be fixed in version 2.4. I guess I misunderstood. I've added my vote to the issue, as I'm working around this by manually writing the application.xml file for my ear. This is un-ideal, as I have to remember to edit it every time I do a release (since the version numbers change).
Hide
Pablo Rodriguez added a comment -
Show
Pablo Rodriguez added a comment - Created http://jira.codehaus.org/browse/MEAR-137
Hide
Stephane Nicoll added a comment -

Fixed with MEAR-137

Show
Stephane Nicoll added a comment - Fixed with MEAR-137

People

Vote (5)
Watch (4)

Dates

  • Created:
    Updated:
    Resolved: