Clear local maven repository via maven-antrun-plugin at pre-clean phase


/ Published in: XML
Save to your folder(s)

By default "mvn clean" cleans only target, for clear local repository run:
mvn clean -Dskip.repo.clean=false


Copy this code and paste it in your HTML
  1. <project>
  2. <!--
  3.  
  4. At least GAV are required here
  5.  
  6. -->
  7. <properties>
  8. <skip.repo.clean>true</skip.repo.clean>
  9. </properties>
  10. <build>
  11. <plugins>
  12. <plugin>
  13. <artifactId>maven-antrun-plugin</artifactId>
  14. <version>1.7</version>
  15. <executions>
  16. <execution>
  17. <id>clear-repo</id>
  18. <phase>pre-clean</phase>
  19. <goals>
  20. <goal>run</goal>
  21. </goals>
  22. <configuration>
  23. <skip>${skip.repo.clean}</skip>
  24. <target>
  25. <echo>Purging ${settings.localRepository}...</echo>
  26. <delete>
  27. <fileset dir="${settings.localRepository}">
  28. <include name="**/*.jar"/>
  29. <include name="**/*.pom"/>
  30. <include name="**/*.sha1"/>
  31. </fileset>
  32. </delete>
  33. </target>
  34. </configuration>
  35. </execution>
  36. </executions>
  37. </plugin>
  38. </plugins>
  39. </build>
  40. </project>

URL: mvn_antrun_preclean_clear_repo

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.