[jboss-user] [EJB 3.0] - Improvement for org.jboss.ejb3.embedded.EJB3StandaloneBootst

jc7442 do-not-reply at jboss.com
Fri Jul 28 03:57:11 EDT 2006

When we start scanClasspath method, EJB3StandaloneBoostrap class defines a set of ignoredJars. These jars are not scan for deploy.
ignoredJars is public static, consequently we can add some of our jars in the list (such as junit, jdbc driver, ...)

When using build tools such as maven jars are named with - for example junit-3.8.2.jar. If we have added junit-3.8.2.jar in the set of jar to ignore, when we will migrate to next junit version we will have to update the set. When we have a lot of dependency the risk is to forget some librairies. 

A nice features will be that list of jars to ignore contains regular expression for jar (such has junit*.jar: ".*.junit-\\d.\\d.\\d.jar"). 

Then it will be possible to list all our jars without taking care about the release. And when we will change the release of our components, it will not affect our list of jar to ignore. 

Code may looks like:
protected boolean accept(String file) {
  |     for (String pattern : ignoredJars) {
  |       if (file.matches(pattern)) {
  |         return false;
  |       }
  |     }
  |     return true;
  |   }
  |   public static HashSet<String> ignoredJars = new HashSet<String>();
  |   static {
  |     ignoredJars.add(".*.junit.*.jar");
  |     ignoredJars.add(".*.commons-.*.jar");
  |     ignoredJars.add(".*.jboss-.*.jar");
  |     ...
  |   }
  | public static void scanClasspath()  
  |      {  
  | //if (ignoredJars.contains(fp.getName())) continue; 
  | if (!accept(fp.getName())) continue;
  | ...
  | ...}

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3961503#3961503

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3961503

More information about the jboss-user mailing list