title: Weld class not found when executing cdi-unit test
body: <p>I have a JEE project that is deployed on wildfly 10 smoothly.</p>
  
  <p>I'm trying to write junit tests for my CDI beans with cdi-unit library (<a href="http://bryncooke.github.io/cdi-unit/" rel="nofollow noreferrer">http://bryncooke.github.io/cdi-unit/</a>)</p>
  
  <p>My <code>pom.xml</code> looks like the following:</p>
  
  <pre><code>&lt;dependency&gt;
      &lt;groupId&gt;javax&lt;/groupId&gt;
      &lt;artifactId&gt;javaee-api&lt;/artifactId&gt;
      &lt;version&gt;7.0&lt;/version&gt;
      &lt;scope&gt;provided&lt;/scope&gt;
  &lt;/dependency&gt;
  
  &lt;dependency&gt;
      &lt;groupId&gt;junit&lt;/groupId&gt;
      &lt;artifactId&gt;junit&lt;/artifactId&gt;
      &lt;version&gt;4.12&lt;/version&gt;
      &lt;scope&gt;test&lt;/scope&gt;
  &lt;/dependency&gt;
  
  &lt;dependency&gt;
       &lt;groupId&gt;org.jglue.cdi-unit&lt;/groupId&gt;
       &lt;artifactId&gt;cdi-unit&lt;/artifactId&gt;
       &lt;version&gt;4.0.1&lt;/version&gt;
       &lt;scope&gt;test&lt;/scope&gt;
  &lt;/dependency&gt;
  </code></pre>
  
  <p>However my sample test:</p>
  
  <pre><code>@RunWith(CdiRunner.class)
  public class SampleTest {
  
     @Inject
     private Foo foo;
  
     @Test
     public void testFoo(){
        foo.bar();
     }
  }
  </code></pre>
  
  <p>fails to initialize due to missing weld class:</p>
  
  <pre><code>java.lang.NoClassDefFoundError: org/jboss/weld/environment/se/Weld
      at java.lang.Class.getDeclaredConstructors0(Native Method)
      at java.lang.Class.privateGetDeclaredConstructors(Class.java:2671)
      at java.lang.Class.getConstructor0(Class.java:3075)
      at java.lang.Class.getConstructor(Class.java:1825)
      at org.junit.internal.builders.AnnotatedBuilder.buildRunner(AnnotatedBuilder.java:104)
      at org.junit.internal.builders.AnnotatedBuilder.runnerForClass(AnnotatedBuilder.java:86)
      at org.junit.runners.model.RunnerBuilder.safeRunnerForClass(RunnerBuilder.java:59)
      at org.junit.internal.builders.AllDefaultPossibilitiesBuilder.runnerForClass(AllDefaultPossibilitiesBuilder.java:26)
      at org.junit.runners.model.RunnerBuilder.safeRunnerForClass(RunnerBuilder.java:59)
      at org.junit.internal.requests.ClassRequest.getRunner(ClassRequest.java:33)
      at org.eclipse.jdt.internal.junit4.runner.JUnit4TestLoader.createUnfilteredTest(JUnit4TestLoader.java:84)
      at org.eclipse.jdt.internal.junit4.runner.JUnit4TestLoader.createTest(JUnit4TestLoader.java:70)
      at org.eclipse.jdt.internal.junit4.runner.JUnit4TestLoader.loadTests(JUnit4TestLoader.java:43)
      at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:444)
      at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:678)
      at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:382)
      at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:192)
  Caused by: java.lang.ClassNotFoundException: org.jboss.weld.environment.se.Weld
      at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
      at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
      at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331)
      at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
      ... 17 more
  </code></pre>
  
  <p>CDI-UNIT manual says <a href="http://bryncooke.github.io/cdi-unit/#using-a-specific-version-of-weld" rel="nofollow noreferrer">here</a> that it automatically uses it's own version of Weld, hence there is no need to explicitly add any weld libraries in pom.xml.</p>
  
  <p>Any help please?</p>