Maven build automatically removing a jar?

If you have a maven build mysteriously deleting the jar it’s building, double check your POM hierarchy to make sure you dont have some non-sense such as this in there:

  1. <plugin>
  2.     <groupId>org.apache.maven.plugins</groupId>
  3.     <artifactId>maven-clean-plugin</artifactId>
  4.     <version>2.1</version>
  5.     <executions>
  6.         <execution>
  7.             <id>auto-clean</id>
  8.             <phase>validate</phase>
  9.             <goals>
  10.                 <goal>clean</goal>
  11.             </goals>
  12.         </execution>
  13.     </executions>
  14. </plugin>

In my case this was in a copy/pasted reactor pom, lingering at the bottom of my plugins list. When I added a maven-source-plugin directive to generate sources, the original jar would be deleted by that unintended maven-clean-plugin directive earlier in the pom.

Thanks to Jason Duke for figuring this out.