title: Return JavaScript as static resource from a Jar archive
body: <p>Is there a way to return JavaScript that is located in a .jar archive? At the moment I have the following structure:</p>
  
  <pre><code>webapp
     resources
          scripts
             SomeJavaScript.js
             ...
  </code></pre>
  
  <p>List of such .js files is very large. And there is a .jar file that has all such files.</p>
  
  <p>In Spring config files I have:</p>
  
  <pre><code>  &lt;mvc:resources mapping="/resources/**" location="/resources/"/&gt;
  </code></pre>
  
  <p>To process all static resources by my dispatcher servlet. But, I'd like it to read the JavaScript files from the .jar archive.  What's the easiest way to do that?</p>
  
  <p>I think writing my own controller for such purpose would not be the best option.</p>
  
  <p>PS: I've found the <a href="https://stackoverflow.com/questions/4732965/exposing-resources-from-jar-files-in-web-applications-tomcat7">following solution</a>:</p>
  
  <p>I'm using embedded Tomcat 7, starting it using Maven plugin.
  Here's <a href="https://blogs.oracle.com/alexismp/entry/web_inf_lib_jar_meta" rel="nofollow noreferrer">mentioned</a> that resource files need to be under <code>WEB-INF/lib/{\*.jar}/META-INF/resources</code> but looking inside <code>spring-js-resources.jar</code>, the actual location is <code>WEB-INF/lib/{\*.jar}/META-INF/web-resources</code>. The generated page contains links like these:</p>
  
  <pre><code>&lt;script type="text/javascript" src="/SomeProjectName/dojo/dojo.js"&gt;&lt;/script&gt;
  </code></pre>
  
  <p>And this file is not available. What can I do to resolve the problem? </p>
  
  <p>Thanks.</p>