title: How to access common resource files from multiple projects
body: <p>In one of my projects I have resources stored in <code>/src/test/resources</code> (typical maven directory structure). Those resources are being used by an utility class stored in the project.</p>
  
  <p>The utility class itself is being used from other projects (other projects depend on this one). I would access the resource like that:</p>
  
  <pre><code>final InputStream inputStreamDobs = 
      ClassLoader.class.getResourceAsStream("/dbunit/clear_db.xml");
  </code></pre>
  
  <p>but since I use it from different projects the path is not correct - it is relative to <code>current project that is being built/tested</code>, not the one where utility class and resources are.</p>
  
  <p><strong>Any thought how to approach this?</strong></p>
  
  <p>I need to avoid absolute paths - would like to have a way of defining relative path to the utility class.</p>
  
  <p>I also don't want to replicate resources over multiple projects. Cheers.</p>
  
  <p><strong>EDIT:</strong>
  To give a context I have a definition of tables in XML file that needs to be cleared after Integration Tests (clear whole DB schema). Integration Tests sits in multiple project, but the clear script and resource file is the same for all of them and sits in common parent project.</p>
  
  <p><strong>EDIT2:</strong></p>
  
  <p><strong>Bonus question:</strong> I would like to access common DTD file (let's call it <code>tables.dtd</code>) that need to be accessed from XML files from multiple other projects. (it will sit in common parent project).</p>
  
  <p>Currently I have it duplicated over multiple project, and I refer to it from XML using directive:</p>
  
  <pre><code>&lt;!DOCTYPE dataset SYSTEM "src/test/resources/dbunit/dobs.dtd"&gt;
  </code></pre>
  
  <p>How to point it to a file in different  project?</p>