Adding external resources to class-path in Tomcat 8

Just another example:

Please note the comments inside and note that I used PostResources and not PreResources so that I can override classes in my current project if I'm not happy with my "util" implementation. I'm not actually sure if JarResource is treated as a "PostResource" or "PreResource" but overriding static content and classes works.

    <!--
         https://tomcat.apache.org/tomcat-8.0-doc/config/resources.html
         http://stackoverflow.com/questions/23143697/adding-external-resources-to-class-path-in-tomcat-8
         http://stackoverflow.com/questions/34515852/tomcat-7-application-migration-to-tomcat-8
         http://mikusa.blogspot.co.za/2014/07/tips-on-migrating-to-tomat-8-resources.html
    -->
    <Context path="/MY_PROJECT" docBase="/MY_PROJECT">
        <Resources className="org.apache.catalina.webresources.StandardRoot">
            <!-- Post-load the static content from my util project -->
            <PostResources className="org.apache.catalina.webresources.DirResourceSet"
                    base="/workspace/MY_UTIL_PROJECT/WebContent"
                    webAppMount="/">
            </PostResources>
            <!-- Post-load the classes from my util project -->
            <PostResources className="org.apache.catalina.webresources.DirResourceSet"
                    base="/workspace/MY_UTIL_PROJECT/WebContent/WEB-INF/classes"
                    webAppMount="/WEB-INF/classes">
            </PostResources>
            <!-- Load the JARs contained within my util project -->
            <JarResources className="org.apache.catalina.webresources.DirResourceSet"
                    base="/workspace/MY_UTIL_PROJECT/WebContent/WEB-INF/lib"
                    webAppMount="/WEB-INF/lib">
            </JarResources>
        </Resources>
    </Context>

There is a section about this in the Tomcat 8 migration guide which will direct you to use a resources configuration

In particular, you will be creating a WebResourceRoot object which contains the following text in its description.

VirtualWebappLoader - Replaced by Pre- and Post-Resources mapped to WEB-INF/lib and WEB-INF/classes

Your new context.xml will look something like the following:

<Context>
    <Resources className="org.apache.catalina.webresources.StandardRoot">
        <PreResources className="org.apache.catalina.webresources.DirResourceSet"
            base="C:\\PROJECT_NAME\\conf"
            internalPath="/"
            webAppMount="/WEB-INF/classes" />
    </Resources>
</Context>