making Apache Maven perform extra cleanup as part of the "clean" task

Posted on 2005-05-09
Last Modified: 2013-11-18
Hi there,
I'm using a Maven plugin called jcoverage to generate reports showing the level of test coverage within my project.

However the plugin is far from perfect and leaves a jcoverage.ser file in the project root directory.

I would like to add a task or goal ( sorry not very familiar with Maven terminology ) so that when you call maven clean it will
by default remove this file as well.

Can this be done ?


Question by:revoltingdigits
    LVL 86

    Expert Comment

    Why not use an Ant Delete task on the file?

    Author Comment

    Well what I want is for it to be encapsulated.

    If another developer is working with the project and calls "maven clean" that it will perform this deletion.

    I know you can integrate ANT tasks easily with maven but I don't want to create something new that the developer will need to know the name of.

    Is it possible to configure maven via the project.xml or maven.xml file so that it runs this deletion before it runs the standard maven:clean task
    ( ie removes the "target" directory ) .

    thanks in advance

    LVL 86

    Expert Comment

    >>Is it possible to configure maven ...

    Not sure to tell you the truth. It should be possible to override the clean operation

    Author Comment

    I managed to do this using the following in maven.xml by pulling in the ant tasks and then defining a
    post processing step for the "clean" goal
    <project ... etc etc
    <postGoal name="clean">
    <ant:delete file="blah.txt"/>

    Author Comment

    I answered this question myself ( see above )

    Accepted Solution

    PAQed with points refunded (50)

    Community Support Moderator

    Featured Post

    Highfive + Dolby Voice = No More Audio Complaints!

    Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

    Join & Write a Comment

    Suggested Solutions

    Title # Comments Views Activity
    NotAlone Challenge 20 65
    maxMirror challenge 10 69
    Jave - Remove carriage return + special characters from text 3 52
    endX challenge 2 33
    Introduction Java can be integrated with native programs using an interface called JNI(Java Native Interface). Native programs are programs which can directly run on the processor. JNI is simply a naming and calling convention so that the JVM (Java…
    Basic understanding on "OO- Object Orientation" is needed for designing a logical solution to solve a problem. Basic OOAD is a prerequisite for a coder to ensure that they follow the basic design of OO. This would help developers to understand the b…
    Video by: Michael
    Viewers learn about how to reduce the potential repetitiveness of coding in main by developing methods to perform specific tasks for their program. Additionally, objects are introduced for the purpose of learning how to call methods in Java. Define …
    Viewers will learn about the regular for loop in Java and how to use it. Definition: Break the for loop down into 3 parts: Syntax when using for loops: Example using a for loop:

    733 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    20 Experts available now in Live!

    Get 1:1 Help Now