title: how to compile src/test/java with maven when test code and main java code depends on the same jar file?
body: <p>I am beginning to learn Maven and ran into a problem when I am trying to compile the test source code in a maven project.</p>
  
  <p>My main java source code is dependent on a jar file so I have a dependency declared in my pom file as following:</p>
  
  <pre><code>&lt;project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"&gt;
  &lt;modelVersion&gt;4.0.0&lt;/modelVersion&gt;
  &lt;groupId&gt;com.mycompany&lt;/groupId&gt;
  &lt;artifactId&gt;myMavenApp&lt;/artifactId&gt;
  &lt;version&gt;0.0.1-SNAPSHOT&lt;/version&gt;
  
  &lt;dependencies&gt;
  
  
      &lt;dependency&gt;
          &lt;groupId&gt;com.mycompany.maven.testapp&lt;/groupId&gt;
          &lt;artifactId&gt;domain&lt;/artifactId&gt;
          &lt;version&gt;1.0&lt;/version&gt;          
      &lt;/dependency&gt;
  </code></pre>
  
  <p></p>
  
  <p>Compile error when compiling the test code:</p>
  
  <p>[ERROR] \projects\news\publishing\src\test\java\com\mycompany\transformers\monitoring\JournalMonitorTest.java:[40,30] cannot find symbol
  [ERROR] symbol  : class JournalMonitor
  [ERROR] location: class com.mycompany.transformers.monitoring.JournalMonitorTest</p>