title: Using static resources (such as JQuery) in jira plugin
body: <p>How to include web resources in Atlassian Jira 4.4 plugin?</p>
  
  <p>atlassian-plugin.xml:</p>
  
  <pre><code> &lt;web-resource key="statistics-resources" name="statistics"&gt;
      &lt;resource type="download" name="statistics.js" location="js/statistics/statistics.js"/&gt;
      &lt;dependency&gt;jira.webresources:jira-global&lt;/dependency&gt;
      &lt;context&gt;com.cs.jira.plugins.statistics-resources&lt;/context&gt;
  &lt;/web-resource&gt;
  </code></pre>
  
  <p>statistics.js:</p>
  
  <pre><code>$("#projects").change(function() {
  $(location).attr('href', "/jira/secure/StatisticsModuleAction!project.jspa?project=" + $(this).find("option:selected").text());});
  </code></pre>
  
  <p>Including resources in Velocity template:</p>
  
  <pre><code>$webResourceManager.requireResourcesForContext("com.cs.jira.plugins.statistics-resources")
  </code></pre>
  
  <p>When i try to call javascript function from my statistics.js, i get this error:</p>
  
  <blockquote>
    <p>Uncaught TypeError: Property '$' of object [object Window] is not a function </p>
  </blockquote>
  
  <p>Then i tried to include external jQuery library:</p>
  
  <pre><code>&lt;web-resource key="statistics-resources" name="statistics"&gt;
      &lt;resource type="download" name="jquery-1.8.2.js" location="js/lib/jquery-1.8.2.js"/&gt;
      &lt;resource type="download" name="statistics.js" location="js/statistics/statistics.js"/&gt;
      &lt;dependency&gt;jira.webresources:jira-global&lt;/dependency&gt;
      &lt;context&gt;com.cs.jira.plugins.statistics-resources&lt;/context&gt;
  &lt;/web-resource&gt;
  </code></pre>
  
  <p>i got another error in batch.js:</p>
  
  <blockquote>
    <p>Uncaught TypeError: Object [object Object] has no method 'handleAccessKeys'</p>
  </blockquote>
  
  <p>How can i include my resources properly? </p>