title: how to exclude test dependences in gradle
body: <p>first, I have a project like this:</p>
  
  <pre><code>project-a
     src
        main
            java
                A.java
        test
            java
                ATest.java
  </code></pre>
  
  <p>then, I have another project like this:</p>
  
  <pre><code>project-b
     src
        main
            java
                B.java
        test
            java
                BTest.java
  </code></pre>
  
  <p>the build.gradle configuration, project-b dependence project-a</p>
  
  <pre><code>dependencies{
      compile project(":project-a")
  }
  </code></pre>
  
  <p>the question is BTest.java can access ATest.java, how to avoid this?</p>
  
  <p>-------------------show more detail---------------
  <a href="https://i.stack.imgur.com/CiEHu.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/CiEHu.jpg" alt="enter image description here"></a></p>
  
  <p>settings.gradle</p>
  
  <pre><code>rootProject.name = 'test-dependence'
  
  include 'project-a', 'project-b'
  </code></pre>
  
  <p>project-b/build.gradle</p>
  
  <pre><code>dependencies {
     compile project(":project-a")
     testCompile group: 'junit', name: 'junit', version: '4.12'
  }
  </code></pre>