title: Limiting available beans via Maven
body: <p>I use Maven to manage my web application using Spring. I do have two main directories - /src/main/java and /src/test/java - where the all testing stuff lies (tests, mocks, etc).
  The tests run smoothly both from maven command line and my IDE. Problem is when I deploy my application and I get this message:</p>
  
  <pre><code>java.lang.IllegalStateException: More than one bean of type    [pl.m4ks.comics.dao.IComicDAO] found, you have to specify the name of the bean (@SpringBean(name="foo")) in order to resolve this conflict. Matched beans: comicDAO,comicDAOMock
   at org.apache.wicket.spring.injection.annot.AnnotProxyFieldValueFactory.getBeanNameOfClass(AnnotProxyFieldValueFactory.java:231)
  </code></pre>
  
  <p>But the problem is that comicDAOMock resides inside /scr/test directory and should be not visible during non-test deploy! I use </p>
  
  <pre><code>&lt;context:component-scan base-package="pl.m4ks.comics"/&gt;
  &lt;context:annotation-config /&gt;
  </code></pre>
  
  <p>in my context.xml (for testing I use other context where beans are wired manually).</p>
  
  <p>In pom.xml I do have:</p>
  
  <pre><code>        &lt;resources&gt;
          &lt;resource&gt;
              &lt;directory&gt;src/main/resources&lt;/directory&gt;
              &lt;includes&gt;
                  &lt;include&gt;**&lt;/include&gt;
              &lt;/includes&gt;
              &lt;excludes&gt;
                  &lt;exclude&gt;**/*.java&lt;/exclude&gt;
              &lt;/excludes&gt;
          &lt;/resource&gt;
          &lt;resource&gt;
              &lt;directory&gt;src/main/java&lt;/directory&gt;
              &lt;includes&gt;
                  &lt;include&gt;**&lt;/include&gt;
              &lt;/includes&gt;
              &lt;excludes&gt;
                  &lt;exclude&gt;**/*.java&lt;/exclude&gt;
              &lt;/excludes&gt;
          &lt;/resource&gt;
      &lt;/resources&gt;
  
      &lt;testResources&gt;
          &lt;testResource&gt;
              &lt;directory&gt;src/test/java&lt;/directory&gt;
              &lt;includes&gt;
                  &lt;include&gt;**&lt;/include&gt;
              &lt;/includes&gt;
              &lt;excludes&gt;
                  &lt;exclude&gt;**/*.java&lt;/exclude&gt;
              &lt;/excludes&gt;
          &lt;/testResource&gt;
          &lt;testResource&gt;
              &lt;directory&gt;src/test/resources&lt;/directory&gt;
              &lt;includes&gt;
                  &lt;include&gt;**&lt;/include&gt;
              &lt;/includes&gt;
              &lt;excludes&gt;
                  &lt;exclude&gt;**/*.java&lt;/exclude&gt;
              &lt;/excludes&gt;
          &lt;/testResource&gt;
      &lt;/testResources&gt;
  </code></pre>
  
  <p>So I thought I separated them. How can I solve this, I mean to completely exclude all testing stuff from my deploy run (I run by 'mvn jetty:run' command)</p>