The Java EE 5 specification says that
A .ear file may contain a directory that contains libraries packaged in JAR files. The library-directory element of the .ear file's deployment descriptor contains the name of this directory. If a library-directory element isn't specified,
or if the .ear file does not contain a deployment descriptor, the directory named lib is used. An empty library-directory element may be used to specify
that there is no library directory.
All files in this directory (but not subdirectories) with a .jar extension must be made available to all components packaged in the EAR file, including application clients.
(Section 8.1.2 Application Assembly)
It seems in Idea I cannot currently configure such jars.
Please add support for that.
JBoss supports this starting from version 4.2.0:
http://jira.jboss.com/jira/browse/JBAS-4037
I don't know about other app servers.
Anyway the feature sounds pretty useful to me and I expect to see it used more widely in the future.
IMHO it should be possible to configure these jars directly at the ear module.
Alternatively/additionally it could be possible to have another packaging method "Copy to ear's lib folder" for jars of web and ejb modules.