title: Exclude dependencies from being loaded in JBoss AS7
body: <p>I have a maven war project I am deploying to JBoss AS7. In maven, I have a dependency that is omitted because it conflicts with another dependency. </p>
  
  <p>I was able to run this project as a jar as a java app with a main. But when I convert to a war and run on JBoss it tries to load this conflicting dependency and its really old legacy dependencies (that require websphere runtimes). The classes in this dependency that require these offending dependencies are never actually used.</p>
  
  <p>** Edit **
  JBoss is not trying to unload load the omitted dependency. It is trying to load the dependency that is dependent upon the omitted library. But tries to load all the classes in the dependency but it depends on classes that are in the omitted library. Even though the classes that fail the class loading are never used at runtime.</p>
  
  <p>How can I have this dependency's classes (or the entire war's classes) be loaded only when they are needed instead of when the server is initializing? Is it even possible?</p>
  
  <p>Dependency Tree (Paraphrased...)<br>
  <code>
                      MyWar<br>
                    /       \<br>
  ProprietaryJar_V2.0    AnotherProperietaryJar_V1.0<br>
                                     |<br>
                         ProprietaryJar_V1.0 (omitted)</code></p>