-1

I'm trying to clean, build, and package my project, but I keep getting this error:

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-clean-plugin:2.6.1:clean (auto-clean) on project Presentation: Unable to parse configuration of mojo org.apache.maven.plugins:maven-clean-plugin:2.6.1:clean for parameter retryOnError: Cannot find 'retryOnError' in class org.apache.maven.plugin.clean.CleanMojo -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.apache.maven.plugins:maven-clean-plugin:2.6.1:clean (auto-clean) on project Presentation: Unable to parse configuration of mojo org.apache.maven.plugins:maven-clean-plugin:2.6.1:clean for parameter retryOnError: Cannot find 'retryOnError' in class org.apache.maven.plugin.clean.CleanMojo
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:220)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:108)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:76)
    at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:51)
    at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:116)
    at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:361)
    at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:155)
    at org.apache.maven.cli.MavenCli.execute(MavenCli.java:584)
    at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:213)
    at org.apache.maven.cli.MavenCli.main(MavenCli.java:157)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:483)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229)
    at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415)
    at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)
Caused by: org.apache.maven.plugin.PluginConfigurationException: Unable to parse configuration of mojo org.apache.maven.plugins:maven-clean-plugin:2.6.1:clean for parameter retryOnError: Cannot find 'retryOnError' in class org.apache.maven.plugin.clean.CleanMojo
    at org.apache.maven.plugin.internal.DefaultMavenPluginManager.populatePluginFields(DefaultMavenPluginManager.java:605)
    at org.apache.maven.plugin.internal.DefaultMavenPluginManager.getConfiguredMojo(DefaultMavenPluginManager.java:537)
    at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:120)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:208)
... 19 more
Caused by: org.codehaus.plexus.component.configurator.ComponentConfigurationException: Cannot find 'retryOnError' in class org.apache.maven.plugin.clean.CleanMojo
    at org.eclipse.sisu.plexus.CompositeBeanHelper.setProperty(CompositeBeanHelper.java:252)
    at org.codehaus.plexus.component.configurator.converters.composite.ObjectWithFieldsConverter.processConfiguration(ObjectWithFieldsConverter.java:101)
    at org.codehaus.plexus.component.configurator.BasicComponentConfigurator.configureComponent(BasicComponentConfigurator.java:32)
    at org.apache.maven.plugin.internal.DefaultMavenPluginManager.populatePluginFields(DefaultMavenPluginManager.java:575)
... 22 more

I've been trying to figure this out for myself for a while now. I have the project set up to auto clean, and it's exactly how Apache instructed to do so in the pom file(s), but I'll include that as well.

<project>
    <build>
        ...
        <plugin>
            <artifactId>maven-clean-plugin</artifactId>
            <version>2.6.1</version>
            <configuration>
                <failOnError>false</failOnError>
            </configuration>
            <executions>
                <execution>
                    <id>auto-clean</id>
                    <phase>initialize</phase>
                    <goals>
                        <goal>clean</goal>
                    </goals>
                </execution>
            </executions>
        </plugin>
        ...
    </build>
<project>

I am lost here. Obviously, it has something to do with 'retryOnError', but that's not something I added myself. Where would I find that?

Also, I'm using Maven 3.2.5 if that helps.

Fabien
  • 859
  • 6
  • 15
Mark Roberts
  • 55
  • 1
  • 9
  • 2
    Do you really need a "plugin" to clean up? I think `mvn clean` will do the trick...and for your purpose, executing (at project's root level) `mvn clean package` or `mvn clean verify` is enough – x80486 May 01 '15 at 20:35
  • That's what I was trying to do, originally. mvn clean package results in the same error, as well as mvn clean verify. – Mark Roberts May 01 '15 at 20:37
  • the stacktrace is because the `maven-clean-plugin`; can you comment that part and try `mvn clean`? – x80486 May 01 '15 at 20:39
  • When I do that it says the 'build.plugins.plugin.artifactid' is missing. – Mark Roberts May 01 '15 at 20:43
  • 1
    You must comment from ``; looks like you did it from `` onwards – x80486 May 01 '15 at 20:45

2 Answers2

1

@ɐuıɥɔɐɯ is right.

I would also try removing the auto-clean plugin configuration in your pom.xml, as it may be more work to figure out why it is causing problems than it is worth. For now on, I would simply run the following command in the root folder of your project:

mvn clean package

That should run your goals listed in your pom.xml, and clean your "target" subdirectory, replacing it with the newest code.

See http://www.mkyong.com/maven/how-to-clean-project-with-maven/ for more information.

CtheGood
  • 999
  • 8
  • 17
  • The clean is a life cycle which is called. The maven-clean-plugin is bound by default to this life cycle (clean) which means it is executed. And there is no tool built in for `clean package` this is only the life cycles which are executed. – khmarbaise May 02 '15 at 15:38
  • Thanks for clarifying that for me and for everyone else. I have edited my post accordingly. – CtheGood May 02 '15 at 19:21
1

It looks like the version of the clean plugin you are explicitly configuring differs to the one shipped with maven (or a similar mismatch in default properties)

As the comments above suggest i would remove the entire section of :

<plugin>
    <artifactId>maven-clean-plugin</artifactId>
    <version>2.6.1</version>
    <configuration>
        <failOnError>false</failOnError>
    </configuration>
    <executions>
        <execution>
            <id>auto-clean</id>
            <phase>initialize</phase>
            <goals>
                <goal>clean</goal>
            </goals>
        </execution>
    </executions>
</plugin>

and then run a mvn clean / mvn clean package.

If you are set on using the plugin you should also try setting the property manually in the config as the below:

<plugin>
    <artifactId>maven-clean-plugin</artifactId>
    <version>2.6.1</version>
    <configuration>
        <failOnError>false</failOnError>
        <retryOnError>true</retryOnError>
    </configuration>
    <executions>
        <execution>
            <id>auto-clean</id>
            <phase>initialize</phase>
            <goals>
                <goal>clean</goal>
            </goals>
        </execution>
    </executions>
</plugin>
Fabien
  • 859
  • 6
  • 15
Andrew McKee
  • 1,307
  • 1
  • 10
  • 9
  • This still doesn't work :( I get the same stacktrace, whether I comment out the `plugin` and run `mvn clean` or add the `` parameter. – Mark Roberts May 01 '15 at 20:57
  • Can you share the code in GitHub or something similar? You shouldn't get the same stack trace since it's related with something you don't have (assuming you commented your `` declaration for `maven-clean-plugin`) – x80486 May 01 '15 at 21:00
  • I can't share it, it's commercial software. That's a good way to get myself fired. ;) I can tell you this, though, when I clean from eclipse it does it without a problem. it's just from the command line or the maven-invoker from Apache, and everything else works when I don't include the plugin. It's only clean that is broken. – Mark Roberts May 01 '15 at 21:05
  • Well, thanks for your answer. It was helpful for understanding Maven a bit more, so it was helpful! Thanks again. – Mark Roberts May 01 '15 at 21:26
  • What is exactly broken? maven-invoker-plugin? Why do you need such supplemental options in maven-clean-plugin? – khmarbaise May 02 '15 at 15:35
  • In maven there are no plugins shipped with it. – khmarbaise May 02 '15 at 15:36