What you are describing is already handled by Java and web containers will often add more complex class loading (you are using a war file.)
Let's start with the basic class loading process (oversimplified.) In Java if you try to load a class or use a dependency, it will search the classpath for that dependency. Whatever instance of that dependency is found first, get's pulled in. So if I have two classes in separate jars that both depend on the same Logger class from Log4J, I don't need two copies of Log4J in my classpath. Only one will neverever get used. But there's a problem here. What if one of myyour jars needs version 1 of com.foo.bar.Snafu and another one needs version 2 orof com.foo.bar.Snafu? This simple model won't work for you.
Because the idea behind JEE is that you have a lot of different things running all together with an bazillion dependencies, this comes up a lot. So in my experience (which is not recent - more on that later) most containers offer a more complex classloading model. The first step is to search (recursively) through all parent class loaders for a class. If it is not found, it will be loaded from the web apps local class path. So if you want to have one copy sof Log4J for everyone, you put it on the containers main classpath. If everyone can use that version, you are done. Your wars or ears need not provide binaries for that dependency.
However, if you need different versions for different web apps under this model, that means you need to get it out of the main classpath and add the different versions at different levels of the classpath hierarchy. This is complex and fraught so containers offer the ability to flip that model on it's head in your web app. That is, it will look first in it's local classpath before looking in parent classpaths.
So regardless of which way you go, if you want to share these dependencies, just put them on the classpath at the appropriate level. If they are used by multiple apps, consider putting them at the root.
Another thing to consider is the fact that all of this nonsense kind of sucks to work with. I highly encourage anyone doing web development in Java to consider embedded approaches such as embedding Jetty or embedding Tomcat. It will make your life so much easier and it is much more compatible with containerization.
P.S. One of the comments mentions OSGi. This does, in theory, address a lot of these issues. However, I would not recommend this unless you are a masochist. It makes things far more complicated and won't necessarily work for you.