Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Maven auto-clean on package

I'm having some troubles trying to auto-clean each time i run mvn package. I've added in the POM :

<build>
    <plugins>
        <plugin>
            <artifactId>maven-clean-plugin</artifactId>
            <version>2.5</version>
            <executions>
                <execution>
                    <id>auto-clean</id>
                    <phase>initialize</phase>
                    <goals>
                        <goal>clean</goal>
                    </goals>
                </execution>
            </executions>
        </plugin>
        ...
    </plugins>
    ...
</build>

But i'm getting the following error from M2Eclipse :

Plugin execution not covered by lifecycle configuration: org.apache.maven.plugins:maven-clean-plugin:2.5:clean (execution: auto-clean, phase: initialize)

I've tried other phases like "validate" or "generate-resources" but i'm always getting the same error.

like image 426
Crystark Avatar asked Oct 22 '22 21:10

Crystark


1 Answers

It's not a Maven problem, it's m2eclipse. I haven't used it in a long time, but apparently when you add some plugin executions, you have to add additional configuration to m2eclipse. There's a lengthy description of this error on the Eclipse wiki.

like image 74
Ryan Stewart Avatar answered Oct 27 '22 10:10

Ryan Stewart