How can I stop maven from running TEST twice?
<p>I have a big project with around 5000 test cases. When running <code>mvn clean install</code> it will run the <code>test</code> goal twice (one as part of the install and the second time as part of the <code>surefire</code> plugin).</p>

<p>Why it needs to run the <code>test</code> for the second time? And is there away to force <code>surefire</code> to use the <code>test</code> goal results instead of re-invoking it's own?
I see it as a waste of time and machine resource, especially recently the second round of running the <code>test</code> caused a <code>PermGen</code> build error and no matter how much heap I pump into maven runner it still dies in the second testing round.</p>

<p>This is my surefire pluging configuration:</p>

<pre><code> &lt;plugin&gt;
    &lt;artifactId&gt;maven-surefire-plugin&lt;/artifactId&gt;
    &lt;version&gt;2.18.1&lt;/version&gt;
    &lt;executions&gt;
       &lt;execution&gt;
         &lt;id&gt;default-test&lt;/id&gt;
         &lt;phase&gt;test&lt;/phase&gt;
         &lt;goals&gt;
             &lt;goal&gt;test&lt;/goal&gt;
         &lt;/goals&gt;
         &lt;configuration&gt;
            &lt;parallel&gt;classes&lt;/parallel&gt;
            &lt;threadCount&gt;3&lt;/threadCount&gt;
         &lt;/configuration&gt;
      &lt;/execution&gt;
   &lt;/executions&gt;
&lt;/plugin&gt;
</code></pre>

<p>Is there a way to tweak the plugin to better handle machine resources?</p>

<p>Here is the full default maven profile  which gets executed:</p>

<pre><code>&lt;build&gt;
    &lt;plugins&gt;
        &lt;plugin&gt;
            &lt;groupId&gt;org.apache.maven.plugins&lt;/groupId&gt;
            &lt;artifactId&gt;maven-war-plugin&lt;/artifactId&gt;
            &lt;version&gt;2.0.2&lt;/version&gt;
            &lt;configuration&gt;
                &lt;archive&gt;
                    &lt;manifest&gt;
                        &lt;addDefaultImplementationEntries&gt;true&lt;/addDefaultImplementationEntries&gt;
                    &lt;/manifest&gt;
                    &lt;manifestEntries&gt;
                        &lt;Build-Number&gt;${build.number}&lt;/Build-Number&gt;
                        &lt;Job-Name&gt;${job.name}&lt;/Job-Name&gt;
                        &lt;Build-Url&gt;${build.url}&lt;/Build-Url&gt;
                        &lt;Git-Commit&gt;${git.commit}&lt;/Git-Commit&gt;
                        &lt;Git-Branch&gt;${git.branch}&lt;/Git-Branch&gt;
                        &lt;Timestamp&gt;${maven.build.timestamp}&lt;/Timestamp&gt;
                        &lt;StyleGuide-Version&gt;${styleguide.version}&lt;/StyleGuide-Version&gt;
                    &lt;/manifestEntries&gt;
                &lt;/archive&gt;
                &lt;warName&gt;pss&lt;/warName&gt;
            &lt;/configuration&gt;
        &lt;/plugin&gt;
        &lt;plugin&gt;
            &lt;groupId&gt;com.cj.jshintmojo&lt;/groupId&gt;
            &lt;artifactId&gt;jshint-maven-plugin&lt;/artifactId&gt;
            &lt;version&gt;1.3.0&lt;/version&gt;
            &lt;executions&gt;
                &lt;execution&gt;
                    &lt;goals&gt;
                        &lt;goal&gt;lint&lt;/goal&gt;
                    &lt;/goals&gt;
                &lt;/execution&gt;
            &lt;/executions&gt;
            &lt;configuration&gt;
                &lt;options&gt;maxparams:5,camelcase,eqeqeq,forin,immed,latedef,noarg,noempty,nonew,expr&lt;/options&gt;
                &lt;directories&gt;
                    &lt;directory&gt;src/main/webapp/js/page&lt;/directory&gt;
                &lt;/directories&gt;
                &lt;excludes&gt;
                    &lt;exclude&gt;src/main/webapp/js/page/marketingPreferences.js&lt;/exclude&gt;
                    &lt;exclude&gt;src/main/webapp/js/page/changeCarParkingDetails.js&lt;/exclude&gt;
                    &lt;exclude&gt;src/main/webapp/js/page/angularjs-app.js&lt;/exclude&gt;
                    &lt;exclude&gt;src/main/webapp/js/page/content-cover.js&lt;/exclude&gt;
                    &lt;exclude&gt;src/main/webapp/js/page/amendmentConfirm.js&lt;/exclude&gt;
                &lt;/excludes&gt;
            &lt;/configuration&gt;
        &lt;/plugin&gt;
        &lt;plugin&gt;
            &lt;groupId&gt;org.lesscss&lt;/groupId&gt;
            &lt;artifactId&gt;lesscss-maven-plugin&lt;/artifactId&gt;
            &lt;version&gt;1.3.3&lt;/version&gt;
            &lt;executions&gt;
                &lt;execution&gt;
                    &lt;id&gt;bingleless&lt;/id&gt;
                    &lt;configuration&gt;
                        &lt;sourceDirectory&gt;${project.basedir}/src/main/webapp/app-resources/&lt;/sourceDirectory&gt;
                        &lt;outputDirectory&gt;${project.basedir}/src/main/webapp/app-resources/&lt;/outputDirectory&gt;
                        &lt;includes&gt;
                            &lt;include&gt;**\/policy-self-service\/**\/*pss-sg.less&lt;/include&gt;
                        &lt;/includes&gt;
                        &lt;compress&gt;true&lt;/compress&gt;
                    &lt;/configuration&gt;
                    &lt;goals&gt;
                        &lt;goal&gt;compile&lt;/goal&gt;
                    &lt;/goals&gt;
                &lt;/execution&gt;
            &lt;/executions&gt;
        &lt;/plugin&gt;
        &lt;plugin&gt;
            &lt;groupId&gt;net.alchim31.maven&lt;/groupId&gt;
            &lt;artifactId&gt;yuicompressor-maven-plugin&lt;/artifactId&gt;
            &lt;version&gt;1.1&lt;/version&gt;
            &lt;executions&gt;
                &lt;execution&gt;
                    &lt;goals&gt;
                        &lt;goal&gt;compress&lt;/goal&gt;
                    &lt;/goals&gt;
                &lt;/execution&gt;
            &lt;/executions&gt;
            &lt;configuration&gt;
                &lt;excludes&gt;
                    &lt;exclude&gt;**/*.min.js&lt;/exclude&gt;
                    &lt;exclude&gt;**/*.min.css&lt;/exclude&gt;
                    &lt;exclude&gt;**/style-guide/**&lt;/exclude&gt;
                    &lt;exclude&gt;**/generated/**&lt;/exclude&gt;
                    &lt;exclude&gt;**/app-resources/common/**&lt;/exclude&gt;
                    &lt;exclude&gt;**/app-resources/bower_components/**&lt;/exclude&gt;
                    &lt;exclude&gt;**/app-resources/policy-self-service/**&lt;/exclude&gt;
                &lt;/excludes&gt;
                &lt;nosuffix&gt;true&lt;/nosuffix&gt;
                &lt;jswarn&gt;false&lt;/jswarn&gt;
            &lt;/configuration&gt;
        &lt;/plugin&gt;
        &lt;plugin&gt;
            &lt;groupId&gt;org.apache.maven.plugins&lt;/groupId&gt;
            &lt;artifactId&gt;maven-checkstyle-plugin&lt;/artifactId&gt;
            &lt;configuration&gt;
                &lt;logViolationsToConsole&gt;true&lt;/logViolationsToConsole&gt;
            &lt;/configuration&gt;
        &lt;/plugin&gt;
        &lt;plugin&gt;
            &lt;artifactId&gt;maven-surefire-plugin&lt;/artifactId&gt;
            &lt;version&gt;${maven-surefire-plugin.version}&lt;/version&gt;
            &lt;configuration&gt;
                &lt;parallel&gt;classes&lt;/parallel&gt;
                &lt;threadCount&gt;3&lt;/threadCount&gt;
            &lt;/configuration&gt;
        &lt;/plugin&gt;
        &lt;plugin&gt;
            &lt;groupId&gt;org.apache.maven.plugins&lt;/groupId&gt;
            &lt;artifactId&gt;maven-surefire-report-plugin&lt;/artifactId&gt;
            &lt;version&gt;${maven-surefire-report-plugin.version}&lt;/version&gt;
            &lt;executions&gt;
                &lt;execution&gt;
                    &lt;phase&gt;install&lt;/phase&gt;
                    &lt;goals&gt;
                        &lt;goal&gt;report-only&lt;/goal&gt;
                    &lt;/goals&gt;
                &lt;/execution&gt;
            &lt;/executions&gt;
        &lt;/plugin&gt;
    &lt;/plugins&gt;
&lt;/build&gt;
</code></pre>