[jboss-as7-dev] A few notes about Modules

David M. Lloyd david.lloyd at redhat.com
Tue Dec 14 17:31:56 EST 2010


Just wanted to give a quick summary of what's going on with Modules in 
AS these last couple of weeks.

The "javax.api" module now includes ONLY non-java.* JDK classes (not 
vendor-specific classes) which also do not appear in EE javax.* modules. 
  In particular, it now excludes other classes which may be on the 
application classpath, so having the JTA API (for example) on the 
classpath won't screw things up like it was before.

As a reminder, DO NOT USE the "system" module.  You usually should be 
using "javax.api" instead.

Some new and changed features of modules.xml files:

1. Before this release, services ("META-INF/services/*") were not 
exported, to avoid issues with unwanted services being found on the 
current module due to dependency import.  Now, when "export" is set to 
"true", everything is exported by default, and services are filtered on 
the *import* side instead.  And, there is a new attribute called 
"services" which specifies whether you want to import services from the 
target module, so you can choose whether you want to import services 
from a module dependency in module.xml.  The possible values are "none" 
(the default) which refuses all services, "import" which brings in 
services, and "export" which brings in and re-exports services from the 
selected dependency.

2. There was some unclear behavior around the fact that there is both an 
"export" attribute and an "exports" sub-element of dependencies.  As of 
Beta12, the listed includes/excludes found in the exports section 
comprise a multi-step filter, in which the rules are evaluated in order 
until a match is found.  If no match is found, then the value of the 
"export" attribute is used to determine whether to export the resource.

So instead of:
         <module name="org.osgi.util" export="true">
             <exports>
                 <include path="org/osgi/util/tracker"/>
                 <exclude path="**"/>
             </exports>
         </module>
We can do:
         <module name="org.osgi.util" export="false">
             <exports>
                 <include path="org/osgi/util/tracker"/>
             </exports>
         </module>

As a final note, if you're looking to build snapshots of MSC and/or 
Modules (to work on the bootstrap AS branch for example), you must build 
both, and you must build and install Modules *first* because MSC relies 
on recent changes in Modules.
-- 
- DML



More information about the jboss-as7-dev mailing list