Hi,
I'm sorry for the assigneed directly, I accidentally cloned a jira issued on similar problem last night.
Now, in regards to the problem:
If we have a project like the sample project provided by this link
http://jira.codehaus.org/browse/MNG-743
Let's simplify ear/pom.xml to:
<project>
<modelVersion>4.0.0</modelVersion>
<groupId>root.project</groupId>
<artifactId>ear</artifactId>
<packaging>ear</packaging>
<version>1.0</version>
<name>ear assembly</name>
<parent>
<groupId>root</groupId>
<artifactId>project</artifactId>
<version>1.0</version>
</parent>
<dependencies>
<dependency>
<groupId>root.project</groupId>
<artifactId>ejbs</artifactId>
<type>ejb</type>
</dependency>
<dependency>
<groupId>root.project.servlets</groupId>
<artifactId>servlet</artifactId>
<type>war</type>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<artifactId>maven-ear-plugin</artifactId>
<configuration>
<archive>
<manifest>
<addClasspath>true</addClasspath>
</manifest>
</archive>
</configuration>
</plugin>
</plugins>
</build>
</project>
When "m2 package" is invoked the generated target/application.xml:
<application>
<display-name>ear</display-name>
<module>
<java>fop-0.20.5.jar</java>
</module>
<module>
<java>primary-source-1.0.jar</java>
</module>
<module>
<java>logging-1.0.jar</java>
</module>
<module>
<web>
<web-uri>servlet-1.0.war</web-uri>
<context-root>/servlet</context-root>
</web>
</module>
<module>
<ejb>ejbs-1.0.jar</ejb>
</module>
</application>
The problem here is logging-1.0.jar, primary-source-1.0.jar, fop-0.20.5.jar are not ejb-client of ejbs-1.0.jar. Hence these jars shouldn't be mentioned inside application.xml and should be identified as library by default.
Now, the next question would be, how are we going to identify ejb-client or standard library without modifying any ear pom.xml
I.e.
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-ear-plugin</artifactId>
<configuration>
<archive>
<manifest>
<addClasspath>true</addClasspath>
</manifest>
</archive>
<javaModule>
<groupId>group1</groupId>
<artifactId>ejbClient1</artifactId>
</javaModule>
</modules>
</configuration>
</plugin>
</plugins>
</build>
Would it be nicer if we have ejb-client type for example? hence, all we have to do is by adding an extra node inside <dependency> (i.e. <dependency> ... <type>ejb-client</type></dependency> for ejb-client or blank for standard library) or use another <packaging> type inside ejb pom.xml, that way we can skip the <build> node all together 
Regards,
Edward
1 Need a way to mark all transitive dependency of a java module to be marked library hence, added the module as class path item inside MANIFEST.MF and excluded during generation of application.xml
2 Need a way to mark all transitive dependency of a java module to be marked excluded hence, excluded during generation of application.xml