title: Running EMMA with JMockit and JUnit in Maven
body: <p>I have a problem when running EMMA code coverage tool with JMockit + JUnit in maven.</p>
  
  <p>I have a project and I am using JMockit as a mocking framework in it. </p>
  
  <p>Once I run <strong>mvn test</strong> it is running successfully without any problem. That’s means JMockit is initializing with JUnit in a proper way.</p>
  
  <p>Following is the way how I define my dependency for JMockit and JUnit within my POM (in the exact order). </p>
  
  <pre><code>&lt;dependency&gt;
      &lt;groupId&gt;com.googlecode.jmockit&lt;/groupId&gt;
       &lt;artifactId&gt;jmockit&lt;/artifactId&gt;
       &lt;version&gt;1.7&lt;/version&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.11&lt;/version&gt;
       &lt;scope&gt;test&lt;/scope&gt;
   &lt;/dependency&gt;
  </code></pre>
  
  <p>But When I check the project for code coverage with EMMA, it says </p>
  
  <pre><code>java.lang.IllegalStateException: JMockit wasn't properly initialized; check that jmockit.jar precedes junit.jar in the classpath (if using JUnit; if not, check the documentation)
  </code></pre>
  
  <p>but I think I have configured EMMA plugin correctly and it is given below,</p>
  
  <pre><code>&lt;build&gt;
  &lt;defaultGoal&gt;install&lt;/defaultGoal&gt;
  &lt;plugins&gt;
  
  &lt;!—Some other plugins here --&gt;
  
      &lt;plugin&gt;
          &lt;groupId&gt;org.codehaus.mojo&lt;/groupId&gt;
          &lt;artifactId&gt;emma-maven-plugin&lt;/artifactId&gt;
          &lt;version&gt;1.0-alpha-3&lt;/version&gt;
          &lt;inherited&gt;true&lt;/inherited&gt;
          &lt;configuration&gt;
              &lt;check&gt;
                  &lt;classRate&gt;100&lt;/classRate&gt;
                  &lt;methodRate&gt;100&lt;/methodRate&gt;
                  &lt;blockRate&gt;70&lt;/blockRate&gt;
                  &lt;haltOnFailure&gt;false&lt;/haltOnFailure&gt;
              &lt;/check&gt;
          &lt;/configuration&gt;
          &lt;executions&gt;
              &lt;execution&gt;
                  &lt;goals&gt;
                      &lt;goal&gt;check&lt;/goal&gt;
                  &lt;/goals&gt;
              &lt;/execution&gt;
          &lt;/executions&gt;
          &lt;dependencies&gt;
              &lt;dependency&gt;
                  &lt;groupId&gt;com.googlecode.jmockit&lt;/groupId&gt;
                  &lt;artifactId&gt;jmockit&lt;/artifactId&gt;
                  &lt;version&gt;1.7&lt;/version&gt;
              &lt;/dependency&gt;
              &lt;dependency&gt;
                  &lt;groupId&gt;junit&lt;/groupId&gt;
                  &lt;artifactId&gt;junit&lt;/artifactId&gt;
                  &lt;scope&gt;runtime&lt;/scope&gt;
                  &lt;version&gt;${junit.version}&lt;/version&gt;
              &lt;/dependency&gt;
          &lt;/dependencies&gt;
      &lt;/plugin&gt;
  &lt;/plugins&gt;
  </code></pre>
  
  <p></p>
  
  <p>Can anyone catch what is wrong there ?</p>