title: Maven Clean doesn't clean the old class and generate new class
body: <p>I am having strange issue in Maven. After doing Maven clean install, when I opened the jar file by 7 zip, inside the jar file, I can see two class files instead of one, which are an old class file and a newly compiled class file with current timestamp as per attached image. </p>
  
  <p>I have tried troubleshooting such as clearing the target folder and trying to recompile, fixing a known issue of Maven compiler 3.1 (useIncrementalCompilation -yes (true)). </p>
  
  <p>However it is still the same and I ran out of ideas. I am also new to Java and it's quite important to me. Any kind of help and idea from you is highly appreciated.</p>
  
  <p>Trans</p>
  
  <p><a href="https://i.stack.imgur.com/k7h4R.png" rel="nofollow noreferrer">Classes</a></p>
  
  <p>POM
  <div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"&gt;
    &lt;modelVersion&gt;4.0.0&lt;/modelVersion&gt;
    &lt;groupId&gt;Some Content here&lt;/groupId&gt;
    &lt;artifactId&gt;alert&lt;/artifactId&gt;
    &lt;version&gt;1&lt;/version&gt;
    &lt;dependencies&gt;
     
   &lt;dependency&gt;
    &lt;groupId&gt;Some Content Here&lt;/groupId&gt;
    &lt;artifactId&gt;processing&lt;/artifactId&gt;
    &lt;version&gt;2.2&lt;/version&gt;
   &lt;/dependency&gt;
  
   &lt;dependency&gt;
    &lt;groupId&gt;javax.mail&lt;/groupId&gt;
    &lt;artifactId&gt;javax.mail-api&lt;/artifactId&gt;
    &lt;version&gt;1.5.6&lt;/version&gt;
   &lt;/dependency&gt;
   &lt;dependency&gt;
    &lt;groupId&gt;javax.activation&lt;/groupId&gt;
    &lt;artifactId&gt;activation&lt;/artifactId&gt;
    &lt;version&gt;1.1.1&lt;/version&gt;
   &lt;/dependency&gt;
   &lt;dependency&gt;
       &lt;groupId&gt;com.sun.mail&lt;/groupId&gt;
       &lt;artifactId&gt;javax.mail&lt;/artifactId&gt;
       &lt;version&gt;1.5.6&lt;/version&gt;
   &lt;/dependency&gt;
   &lt;dependency&gt;
       &lt;groupId&gt;sax&lt;/groupId&gt;
       &lt;artifactId&gt;sax&lt;/artifactId&gt;
       &lt;version&gt;2.0.1&lt;/version&gt;
   &lt;/dependency&gt;
   &lt;dependency&gt;
       &lt;groupId&gt;org.apache.commons&lt;/groupId&gt;
       &lt;artifactId&gt;commons-lang3&lt;/artifactId&gt;
       &lt;version&gt;3.6&lt;/version&gt;
   &lt;/dependency&gt;
    
   &lt;dependency&gt;
       &lt;groupId&gt;javax.servlet&lt;/groupId&gt;
       &lt;artifactId&gt;servlet-api&lt;/artifactId&gt;
       &lt;version&gt;2.5&lt;/version&gt;
   &lt;/dependency&gt;
   &lt;dependency&gt;
    &lt;groupId&gt;javax&lt;/groupId&gt;
    &lt;artifactId&gt;javaee-api&lt;/artifactId&gt;
       &lt;version&gt;6.0&lt;/version&gt;
   &lt;/dependency&gt;
    &lt;/dependencies&gt;
    &lt;build&gt;
      &lt;sourceDirectory&gt;src/main/java&lt;/sourceDirectory&gt; 
    &lt;resources&gt;
     &lt;resource&gt;
            &lt;directory&gt;src/main/resources&lt;/directory&gt;
        &lt;/resource&gt;
       &lt;/resources&gt;
       &lt;plugins&gt;
     &lt;plugin&gt;
            &lt;artifactId&gt;maven-assembly-plugin&lt;/artifactId&gt;
            &lt;executions&gt;
              &lt;execution&gt;
                &lt;phase&gt;package&lt;/phase&gt;
                &lt;goals&gt;
                  &lt;goal&gt;single&lt;/goal&gt;
                &lt;/goals&gt;
              &lt;/execution&gt;
            &lt;/executions&gt;
            &lt;configuration&gt;
              &lt;descriptorRefs&gt;
                &lt;descriptorRef&gt;jar-with-dependencies&lt;/descriptorRef&gt;
              &lt;/descriptorRefs&gt;
            &lt;/configuration&gt;
         &lt;/plugin&gt;
       &lt;/plugins&gt;
   &lt;/build&gt;
  &lt;/project&gt;</code></pre>
  </div>
  </div>
  </p>
  
  <p>Log</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-html lang-html prettyprint-override"><code>[INFO] javax/transaction/UserTransaction.class already added, skipping
  [INFO] META-INF/maven/ already added, skipping
  [INFO] META-INF/maven/javax.javaee.api/ already added, skipping
  [INFO] META-INF/maven/javax.javaee.api/javaee.api-compact/ already added, skipping
  [INFO] META-INF/maven/javax.javaee.api/javaee.api-compact/pom.xml already added, skipping
  [INFO] META-INF/maven/javax.javaee.api/javaee.api-compact/pom.properties already added, skipping
  [INFO] DBConnect.properties already added, skipping
  [INFO] EmailSetting.properties already added, skipping
  [INFO] SourceConnect.properties already added, skipping
  [INFO] 
  [INFO] --- maven-install-plugin:2.4:install (default-install) @ alert ---
  [INFO] Installing C:\AA\alert\target\alert-1.jar to C:\Users\AA\.m2\repository\com\bb\automation\alert\1\alert-1.jar
  [INFO] Installing C:\AA\alert\pom.xml to C:\Users\AA\.m2\repository\com\bb\automation\alert\1\alert-1.pom
  [INFO] Installing C:\AA\alert\target\alert-1-jar-with-dependencies.jar to C:\Users\AA\.m2\repository\com\bb\automation\alert\1\alert-1-jar-with-dependencies.jar
  [INFO] ------------------------------------------------------------------------
  [INFO] BUILD SUCCESS
  [INFO] ------------------------------------------------------------------------
  [INFO] Total time: 5.371 s
  [INFO] Finished at: 2018-03-13T10:47:07+08:00
  [INFO] Final Memory: 39M/404M
  [INFO] ------------------------------------------------------------------------</code></pre>
  </div>
  </div>
  </p>
  
  <p>Effective POM</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;?xml version="1.0"?&gt;
  &lt;project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"&gt;
    &lt;modelVersion&gt;4.0.0&lt;/modelVersion&gt;
    &lt;groupId&gt;Some Content Here&lt;/groupId&gt;
    &lt;artifactId&gt;alert&lt;/artifactId&gt;
    &lt;version&gt;1&lt;/version&gt;
    &lt;dependencies&gt;
      &lt;dependency&gt;
        &lt;groupId&gt;Some Content Here&lt;/groupId&gt;
        &lt;artifactId&gt;processing&lt;/artifactId&gt;
        &lt;version&gt;2.2&lt;/version&gt;
        &lt;scope&gt;compile&lt;/scope&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
        &lt;groupId&gt;javax.mail&lt;/groupId&gt;
        &lt;artifactId&gt;javax.mail-api&lt;/artifactId&gt;
        &lt;version&gt;1.5.6&lt;/version&gt;
        &lt;scope&gt;compile&lt;/scope&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
        &lt;groupId&gt;javax.activation&lt;/groupId&gt;
        &lt;artifactId&gt;activation&lt;/artifactId&gt;
        &lt;version&gt;1.1.1&lt;/version&gt;
        &lt;scope&gt;compile&lt;/scope&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
        &lt;groupId&gt;com.sun.mail&lt;/groupId&gt;
        &lt;artifactId&gt;javax.mail&lt;/artifactId&gt;
        &lt;version&gt;1.5.6&lt;/version&gt;
        &lt;scope&gt;compile&lt;/scope&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
        &lt;groupId&gt;sax&lt;/groupId&gt;
        &lt;artifactId&gt;sax&lt;/artifactId&gt;
        &lt;version&gt;2.0.1&lt;/version&gt;
        &lt;scope&gt;compile&lt;/scope&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
        &lt;groupId&gt;org.apache.commons&lt;/groupId&gt;
        &lt;artifactId&gt;commons-lang3&lt;/artifactId&gt;
        &lt;version&gt;3.6&lt;/version&gt;
        &lt;scope&gt;compile&lt;/scope&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
        &lt;groupId&gt;javax.servlet&lt;/groupId&gt;
        &lt;artifactId&gt;servlet-api&lt;/artifactId&gt;
        &lt;version&gt;2.5&lt;/version&gt;
        &lt;scope&gt;compile&lt;/scope&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
        &lt;groupId&gt;javax&lt;/groupId&gt;
        &lt;artifactId&gt;javaee-api&lt;/artifactId&gt;
        &lt;version&gt;6.0&lt;/version&gt;
        &lt;scope&gt;compile&lt;/scope&gt;
      &lt;/dependency&gt;
    &lt;/dependencies&gt;
    &lt;repositories&gt;
      &lt;repository&gt;
        &lt;snapshots&gt;
          &lt;enabled&gt;false&lt;/enabled&gt;
        &lt;/snapshots&gt;
        &lt;id&gt;central&lt;/id&gt;
        &lt;name&gt;Central Repository&lt;/name&gt;
        &lt;url&gt;https://repo.maven.apache.org/maven2&lt;/url&gt;
      &lt;/repository&gt;
    &lt;/repositories&gt;
    &lt;pluginRepositories&gt;
      &lt;pluginRepository&gt;
        &lt;releases&gt;
          &lt;updatePolicy&gt;never&lt;/updatePolicy&gt;
        &lt;/releases&gt;
        &lt;snapshots&gt;
          &lt;enabled&gt;false&lt;/enabled&gt;
        &lt;/snapshots&gt;
        &lt;id&gt;central&lt;/id&gt;
        &lt;name&gt;Central Repository&lt;/name&gt;
        &lt;url&gt;https://repo.maven.apache.org/maven2&lt;/url&gt;
      &lt;/pluginRepository&gt;
    &lt;/pluginRepositories&gt;
    &lt;build&gt;
      &lt;sourceDirectory&gt;C:\AA\alert\src\main\java&lt;/sourceDirectory&gt;
      &lt;scriptSourceDirectory&gt;C:\AA\alert\src\main\scripts&lt;/scriptSourceDirectory&gt;
      &lt;testSourceDirectory&gt;C:\AA\alert\src\test\java&lt;/testSourceDirectory&gt;
      &lt;outputDirectory&gt;C:\AA\alert\target\classes&lt;/outputDirectory&gt;
      &lt;testOutputDirectory&gt;C:\AA\alert\target\test-classes&lt;/testOutputDirectory&gt;
      &lt;resources&gt;
        &lt;resource&gt;
          &lt;directory&gt;C:\AA\alert\src\main\resources&lt;/directory&gt;
        &lt;/resource&gt;
      &lt;/resources&gt;
      &lt;testResources&gt;
        &lt;testResource&gt;
          &lt;directory&gt;C:\AA\alert\src\test\resources&lt;/directory&gt;
        &lt;/testResource&gt;
      &lt;/testResources&gt;
      &lt;directory&gt;C:\AA\alert\target&lt;/directory&gt;
      &lt;finalName&gt;alert-1&lt;/finalName&gt;
      &lt;pluginManagement&gt;
        &lt;plugins&gt;
          &lt;plugin&gt;
            &lt;artifactId&gt;maven-antrun-plugin&lt;/artifactId&gt;
            &lt;version&gt;1.3&lt;/version&gt;
          &lt;/plugin&gt;
          &lt;plugin&gt;
            &lt;artifactId&gt;maven-assembly-plugin&lt;/artifactId&gt;
            &lt;version&gt;2.2-beta-5&lt;/version&gt;
          &lt;/plugin&gt;
          &lt;plugin&gt;
            &lt;artifactId&gt;maven-dependency-plugin&lt;/artifactId&gt;
            &lt;version&gt;2.8&lt;/version&gt;
          &lt;/plugin&gt;
          &lt;plugin&gt;
            &lt;artifactId&gt;maven-release-plugin&lt;/artifactId&gt;
            &lt;version&gt;2.3.2&lt;/version&gt;
          &lt;/plugin&gt;
        &lt;/plugins&gt;
      &lt;/pluginManagement&gt;
      &lt;plugins&gt;
        &lt;plugin&gt;
          &lt;artifactId&gt;maven-assembly-plugin&lt;/artifactId&gt;
          &lt;version&gt;2.2-beta-5&lt;/version&gt;
          &lt;executions&gt;
            &lt;execution&gt;
              &lt;phase&gt;package&lt;/phase&gt;
              &lt;goals&gt;
                &lt;goal&gt;single&lt;/goal&gt;
              &lt;/goals&gt;
              &lt;configuration&gt;
                &lt;descriptorRefs&gt;
                  &lt;descriptorRef&gt;jar-with-dependencies&lt;/descriptorRef&gt;
                &lt;/descriptorRefs&gt;
              &lt;/configuration&gt;
            &lt;/execution&gt;
          &lt;/executions&gt;
          &lt;configuration&gt;
            &lt;descriptorRefs&gt;
              &lt;descriptorRef&gt;jar-with-dependencies&lt;/descriptorRef&gt;
            &lt;/descriptorRefs&gt;
          &lt;/configuration&gt;
        &lt;/plugin&gt;
        &lt;plugin&gt;
          &lt;artifactId&gt;maven-clean-plugin&lt;/artifactId&gt;
          &lt;version&gt;2.5&lt;/version&gt;
          &lt;executions&gt;
            &lt;execution&gt;
              &lt;id&gt;default-clean&lt;/id&gt;
              &lt;phase&gt;clean&lt;/phase&gt;
              &lt;goals&gt;
                &lt;goal&gt;clean&lt;/goal&gt;
              &lt;/goals&gt;
            &lt;/execution&gt;
          &lt;/executions&gt;
        &lt;/plugin&gt;
        &lt;plugin&gt;
          &lt;artifactId&gt;maven-resources-plugin&lt;/artifactId&gt;
          &lt;version&gt;2.6&lt;/version&gt;
          &lt;executions&gt;
            &lt;execution&gt;
              &lt;id&gt;default-testResources&lt;/id&gt;
              &lt;phase&gt;process-test-resources&lt;/phase&gt;
              &lt;goals&gt;
                &lt;goal&gt;testResources&lt;/goal&gt;
              &lt;/goals&gt;
            &lt;/execution&gt;
            &lt;execution&gt;
              &lt;id&gt;default-resources&lt;/id&gt;
              &lt;phase&gt;process-resources&lt;/phase&gt;
              &lt;goals&gt;
                &lt;goal&gt;resources&lt;/goal&gt;
              &lt;/goals&gt;
            &lt;/execution&gt;
          &lt;/executions&gt;
        &lt;/plugin&gt;
        &lt;plugin&gt;
          &lt;artifactId&gt;maven-jar-plugin&lt;/artifactId&gt;
          &lt;version&gt;2.4&lt;/version&gt;
          &lt;executions&gt;
            &lt;execution&gt;
              &lt;id&gt;default-jar&lt;/id&gt;
              &lt;phase&gt;package&lt;/phase&gt;
              &lt;goals&gt;
                &lt;goal&gt;jar&lt;/goal&gt;
              &lt;/goals&gt;
            &lt;/execution&gt;
          &lt;/executions&gt;
        &lt;/plugin&gt;
        &lt;plugin&gt;
          &lt;artifactId&gt;maven-compiler-plugin&lt;/artifactId&gt;
          &lt;version&gt;3.1&lt;/version&gt;
          &lt;executions&gt;
            &lt;execution&gt;
              &lt;id&gt;default-compile&lt;/id&gt;
              &lt;phase&gt;compile&lt;/phase&gt;
              &lt;goals&gt;
                &lt;goal&gt;compile&lt;/goal&gt;
              &lt;/goals&gt;
            &lt;/execution&gt;
            &lt;execution&gt;
              &lt;id&gt;default-testCompile&lt;/id&gt;
              &lt;phase&gt;test-compile&lt;/phase&gt;
              &lt;goals&gt;
                &lt;goal&gt;testCompile&lt;/goal&gt;
              &lt;/goals&gt;
            &lt;/execution&gt;
          &lt;/executions&gt;
        &lt;/plugin&gt;
        &lt;plugin&gt;
          &lt;artifactId&gt;maven-surefire-plugin&lt;/artifactId&gt;
          &lt;version&gt;2.12.4&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;/execution&gt;
          &lt;/executions&gt;
        &lt;/plugin&gt;
        &lt;plugin&gt;
          &lt;artifactId&gt;maven-install-plugin&lt;/artifactId&gt;
          &lt;version&gt;2.4&lt;/version&gt;
          &lt;executions&gt;
            &lt;execution&gt;
              &lt;id&gt;default-install&lt;/id&gt;
              &lt;phase&gt;install&lt;/phase&gt;
              &lt;goals&gt;
                &lt;goal&gt;install&lt;/goal&gt;
              &lt;/goals&gt;
            &lt;/execution&gt;
          &lt;/executions&gt;
        &lt;/plugin&gt;
        &lt;plugin&gt;
          &lt;artifactId&gt;maven-deploy-plugin&lt;/artifactId&gt;
          &lt;version&gt;2.7&lt;/version&gt;
          &lt;executions&gt;
            &lt;execution&gt;
              &lt;id&gt;default-deploy&lt;/id&gt;
              &lt;phase&gt;deploy&lt;/phase&gt;
              &lt;goals&gt;
                &lt;goal&gt;deploy&lt;/goal&gt;
              &lt;/goals&gt;
            &lt;/execution&gt;
          &lt;/executions&gt;
        &lt;/plugin&gt;
        &lt;plugin&gt;
          &lt;artifactId&gt;maven-site-plugin&lt;/artifactId&gt;
          &lt;version&gt;3.3&lt;/version&gt;
          &lt;executions&gt;
            &lt;execution&gt;
              &lt;id&gt;default-site&lt;/id&gt;
              &lt;phase&gt;site&lt;/phase&gt;
              &lt;goals&gt;
                &lt;goal&gt;site&lt;/goal&gt;
              &lt;/goals&gt;
              &lt;configuration&gt;
                &lt;outputDirectory&gt;C:\AA\alert\target\site&lt;/outputDirectory&gt;
                &lt;reportPlugins&gt;
                  &lt;reportPlugin&gt;
                    &lt;groupId&gt;org.apache.maven.plugins&lt;/groupId&gt;
                    &lt;artifactId&gt;maven-project-info-reports-plugin&lt;/artifactId&gt;
                  &lt;/reportPlugin&gt;
                &lt;/reportPlugins&gt;
              &lt;/configuration&gt;
            &lt;/execution&gt;
            &lt;execution&gt;
              &lt;id&gt;default-deploy&lt;/id&gt;
              &lt;phase&gt;site-deploy&lt;/phase&gt;
              &lt;goals&gt;
                &lt;goal&gt;deploy&lt;/goal&gt;
              &lt;/goals&gt;
              &lt;configuration&gt;
                &lt;outputDirectory&gt;C:\AA\alert\target\site&lt;/outputDirectory&gt;
                &lt;reportPlugins&gt;
                  &lt;reportPlugin&gt;
                    &lt;groupId&gt;org.apache.maven.plugins&lt;/groupId&gt;
                    &lt;artifactId&gt;maven-project-info-reports-plugin&lt;/artifactId&gt;
                  &lt;/reportPlugin&gt;
                &lt;/reportPlugins&gt;
              &lt;/configuration&gt;
            &lt;/execution&gt;
          &lt;/executions&gt;
          &lt;configuration&gt;
            &lt;outputDirectory&gt;C:\AA\alert\target\site&lt;/outputDirectory&gt;
            &lt;reportPlugins&gt;
              &lt;reportPlugin&gt;
                &lt;groupId&gt;org.apache.maven.plugins&lt;/groupId&gt;
                &lt;artifactId&gt;maven-project-info-reports-plugin&lt;/artifactId&gt;
              &lt;/reportPlugin&gt;
            &lt;/reportPlugins&gt;
          &lt;/configuration&gt;
        &lt;/plugin&gt;
      &lt;/plugins&gt;
    &lt;/build&gt;
    &lt;reporting&gt;
      &lt;outputDirectory&gt;C:\AA\alert\target\site&lt;/outputDirectory&gt;
    &lt;/reporting&gt;
  &lt;/project&gt;</code></pre>
  </div>
  </div>
  </p>