I'm doing a maven project,and my IDE is Eclipse。What I cannot grasp is when I use “clean -X” in Eclipse,it will report the following error:
Apache Maven 3.0.4 (r1232337; 2012-01-17 16:44:56+0800)
Maven home: /usr/share/java/apache-maven-3.0.4
Java version: 1.7.0_05, vendor: Oracle Corporation
Java home: /Library/Java/JavaVirtualMachines/1.7.0.jdk/Contents/Home/jre
Default locale: zh_CN, platform encoding: EUC_CN
OS name: "mac os x", version: "10.7.4", arch: "x86_64", family: "mac"
[INFO] Error stacktraces are turned on.
[DEBUG] Reading global settings from /usr/share/java/apache-maven-3.0.4/conf/settings.xml
[DEBUG] Reading user settings from /Users/lingxiubo/Documents/maven/settings.xml
[DEBUG] Using local repository at /Users/lingxiubo/Documents/maven/repo
[DEBUG] Using manager EnhancedLocalRepositoryManager with priority 10 for /Users/lingxiubo/Documents/maven/repo
[INFO] Scanning for projects...
[DEBUG] Extension realms for project org.soft:soft-enrol:war:0.0.1-SNAPSHOT: (none)
[DEBUG] Looking up lifecyle mappings for packaging war from ClassRealm[plexus.core, parent: null]
[DEBUG] === REACTOR BUILD PLAN ================================================
[DEBUG] Project: org.soft:soft-enrol:war:0.0.1-SNAPSHOT
[DEBUG] Tasks: [clean]
[DEBUG] Style: Regular
[DEBUG] =======================================================================
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building soft-enrol Maven Webapp 0.0.1-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[DEBUG] Lifecycle default -> [validate, initialize, generate-sources, process-sources, generate-resources, process-resources, compile, process-classes, generate-test-sources, process-test-sources, generate-test-resources, process-test-resources, test-compile, process-test-classes, test, prepare-package, package, pre-integration-test, integration-test, post-integration-test, verify, install, deploy]
[DEBUG] Lifecycle clean -> [pre-clean, clean, post-clean]
[DEBUG] Lifecycle site -> [pre-site, site, post-site, site-deploy]
[DEBUG] Lifecycle default -> [validate, initialize, generate-sources, process-sources, generate-resources, process-resources, compile, process-classes, generate-test-sources, process-test-sources, generate-test-resources, process-test-resources, test-compile, process-test-classes, test, prepare-package, package, pre-integration-test, integration-test, post-integration-test, verify, install, deploy]
[DEBUG] Lifecycle clean -> [pre-clean, clean, post-clean]
[DEBUG] Lifecycle site -> [pre-site, site, post-site, site-deploy]
[DEBUG] === PROJECT BUILD PLAN ================================================
[DEBUG] Project: org.soft:soft-enrol:0.0.1-SNAPSHOT
[DEBUG] Dependencies (collect): []
[DEBUG] Dependencies (resolve): []
[DEBUG] Repositories (dependencies): [spring-maven-release (http://maven.springframework.org/release, releases+snapshots), spring-maven-milestone (http://maven.springframework.org/milestone, releases+snapshots), JBoss Repo (https://repository.jboss.org/nexus/content/repositories/releases, releases+snapshots), people.apache.snapshots (http://repository.apache.org/content/groups/snapshots-group/, snapshots), central (http://repo.maven.apache.org/maven2, releases)]
[DEBUG] Repositories (plugins) : [apache.snapshots (http://repository.apache.org/content/groups/snapshots-group/, snapshots), central (http://repo.maven.apache.org/maven2, releases)]
[DEBUG] -----------------------------------------------------------------------
[DEBUG] Goal: org.apache.maven.plugins:maven-clean-plugin:2.4.1:clean (default-clean)
[DEBUG] Style: Regular
[DEBUG] Configuration: <?xml version="1.0" encoding="UTF-8"?>
<configuration>
<directory default-value="${project.build.directory}"/>
<excludeDefaultDirectories default-value="false">${clean.excludeDefaultDirectories}</excludeDefaultDirectories>
<failOnError default-value="true">${maven.clean.failOnError}</failOnError>
<followSymLinks default-value="false">${clean.followSymLinks}</followSymLinks>
<outputDirectory default-value="${project.build.outputDirectory}"/>
<reportDirectory default-value="${project.reporting.outputDirectory}"/>
<skip default-value="false">${clean.skip}</skip>
<testOutputDirectory default-value="${project.build.testOutputDirectory}"/>
<verbose>${clean.verbose}</verbose>
</configuration>
[DEBUG] =======================================================================
[INFO]
[INFO] --- maven-clean-plugin:2.4.1:clean (default-clean) @ soft-enrol ---
[DEBUG] Created new class realm maven.api
[DEBUG] Importing foreign packages into class realm maven.api
[DEBUG] Imported: org.apache.maven.wagon.events < plexus.core
[DEBUG] Imported: org.sonatype.aether.transfer < plexus.core
[DEBUG] Imported: org.apache.maven.exception < plexus.core
[DEBUG] Imported: org.sonatype.aether.metadata < plexus.core
[DEBUG] Imported: org.codehaus.plexus.util.xml.Xpp3Dom < plexus.core
[DEBUG] Imported: org.sonatype.aether.collection < plexus.core
[DEBUG] Imported: org.sonatype.aether.version < plexus.core
[DEBUG] Imported: org.apache.maven.monitor < plexus.core
[DEBUG] Imported: org.apache.maven.wagon.repository < plexus.core
[DEBUG] Imported: org.apache.maven.repository < plexus.core
[DEBUG] Imported: org.apache.maven.wagon.resource < plexus.core
[DEBUG] Imported: org.codehaus.plexus.logging < plexus.core
[DEBUG] Imported: org.apache.maven.profiles < plexus.core
[DEBUG] Imported: org.sonatype.aether.repository < plexus.core
[DEBUG] Imported: org.apache.maven.classrealm < plexus.core
[DEBUG] Imported: org.apache.maven.execution < plexus.core
[DEBUG] Imported: org.sonatype.aether.artifact < plexus.core
[DEBUG] Imported: org.sonatype.aether.spi < plexus.core
[DEBUG] Imported: org.apache.maven.reporting < plexus.core
[DEBUG] Imported: org.apache.maven.usability < plexus.core
[DEBUG] Imported: org.codehaus.plexus.container < plexus.core
[DEBUG] Imported: org.codehaus.plexus.component < plexus.core
[DEBUG] Imported: org.codehaus.plexus.util.xml.pull.XmlSerializer < plexus.core
[DEBUG] Imported: org.apache.maven.wagon.authentication < plexus.core
[DEBUG] Imported: org.apache.maven.lifecycle < plexus.core
[DEBUG] Imported: org.codehaus.plexus.classworlds < plexus.core
[DEBUG] Imported: org.sonatype.aether.graph < plexus.core
[DEBUG] Imported: org.sonatype.aether.* < plexus.core
[DEBUG] Imported: org.apache.maven.settings < plexus.core
[DEBUG] Imported: org.codehaus.classworlds < plexus.core
[DEBUG] Imported: org.sonatype.aether.impl < plexus.core
[DEBUG] Imported: org.apache.maven.wagon.* < plexus.core
[DEBUG] Imported: org.apache.maven.toolchain < plexus.core
[DEBUG] Imported: org.sonatype.aether.deployment < plexus.core
[DEBUG] Imported: org.apache.maven.wagon.observers < plexus.core
[DEBUG] Imported: org.codehaus.plexus.util.xml.pull.XmlPullParserException < plexus.core
[DEBUG] Imported: org.codehaus.plexus.util.xml.pull.XmlPullParser < plexus.core
[DEBUG] Imported: org.apache.maven.configuration < plexus.core
[DEBUG] Imported: org.apache.maven.cli < plexus.core
[DEBUG] Imported: org.sonatype.aether.installation < plexus.core
[DEBUG] Imported: org.codehaus.plexus.context < plexus.core
[DEBUG] Imported: org.apache.maven.wagon.authorization < plexus.core
[DEBUG] Imported: org.apache.maven.project < plexus.core
[DEBUG] Imported: org.apache.maven.rtinfo < plexus.core
[DEBUG] Imported: org.codehaus.plexus.lifecycle < plexus.core
[DEBUG] Imported: org.codehaus.plexus.configuration < plexus.core
[DEBUG] Imported: org.apache.maven.artifact < plexus.core
[DEBUG] Imported: org.apache.maven.model < plexus.core
[DEBUG] Imported: org.apache.maven.* < plexus.core
[DEBUG] Imported: org.apache.maven.wagon.proxy < plexus.core
[DEBUG] Imported: org.sonatype.aether.resolution < plexus.core
[DEBUG] Imported: org.apache.maven.plugin < plexus.core
[DEBUG] Imported: org.codehaus.plexus.* < plexus.core
[DEBUG] Imported: org.codehaus.plexus.personality < plexus.core
[DEBUG] Populating class realm maven.api
[DEBUG] org.apache.maven.plugins:maven-clean-plugin:jar:2.4.1:
[DEBUG] org.apache.maven:maven-plugin-api:jar:2.0.6:compile
[DEBUG] org.codehaus.plexus:plexus-utils:jar:2.0.5:compile
[DEBUG] Created new class realm plugin>org.apache.maven.plugins:maven-clean-plugin:2.4.1
[DEBUG] Importing foreign packages into class realm plugin>org.apache.maven.plugins:maven-clean-plugin:2.4.1
[DEBUG] Imported: < maven.api
[DEBUG] Populating class realm plugin>org.apache.maven.plugins:maven-clean-plugin:2.4.1
[DEBUG] Included: org.apache.maven.plugins:maven-clean-plugin:jar:2.4.1
[DEBUG] Included: org.codehaus.plexus:plexus-utils:jar:2.0.5
[DEBUG] Excluded: org.apache.maven:maven-plugin-api:jar:2.0.6
[DEBUG] Configuring mojo org.apache.maven.plugins:maven-clean-plugin:2.4.1:clean from plugin realm ClassRealm[plugin>org.apache.maven.plugins:maven-clean-plugin:2.4.1, parent: sun.misc.Launcher$AppClassLoader@424b29cf]
[DEBUG] Configuring mojo 'org.apache.maven.plugins:maven-clean-plugin:2.4.1:clean' with basic configurator -->
[DEBUG] (f) directory = /Users/lingxiubo/Desktop/chenyl/soft-enrol/target
[DEBUG] (f) excludeDefaultDirectories = false
[DEBUG] (f) failOnError = true
[DEBUG] (f) followSymLinks = false
[DEBUG] (f) outputDirectory = /Users/lingxiubo/Desktop/chenyl/soft-enrol/target/classes
[DEBUG] (f) reportDirectory = /Users/lingxiubo/Desktop/chenyl/soft-enrol/target/site
[DEBUG] (f) skip = false
[DEBUG] (f) testOutputDirectory = /Users/lingxiubo/Desktop/chenyl/soft-enrol/target/test-classes
[DEBUG] -- end configuration --
[INFO] Deleting /Users/lingxiubo/Desktop/chenyl/soft-enrol/target
[INFO] Deleting directory /Users/lingxiubo/Desktop/chenyl/soft-enrol/target/test-classes
[INFO] Deleting dangling symlink /Users/lingxiubo/Desktop/chenyl/soft-enrol/target/soft-enrol/resource/image/login/?????? 1011_theme_asia.jpg
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 0.332s
[INFO] Finished at: Sat Aug 04 15:10:46 CST 2012
[INFO] Final Memory: 7M/101M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-clean-plugin:2.4.1:clean (default-clean) on project soft-enrol: Failed to clean project: Failed to delete /Users/lingxiubo/Desktop/chenyl/soft-enrol/target/soft-enrol/resource/image/login/?????? 1011_theme_asia.jpg -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.apache.maven.plugins:maven-clean-plugin:2.4.1:clean (default-clean) on project soft-enrol: Failed to clean project: Failed to delete /Users/lingxiubo/Desktop/chenyl/soft-enrol/target/soft-enrol/resource/image/login/?????? 1011_theme_asia.jpg
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:217)
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:84)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:59)
at org.apache.maven.lifecycle.internal.LifecycleStarter.singleThreadedBuild(LifecycleStarter.java:183)
at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:161)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:320)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:156)
at org.apache.maven.cli.MavenCli.execute(MavenCli.java:537)
at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:196)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:141)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:601)
at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:290)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:230)
at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:409)
at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:352)
Caused by: org.apache.maven.plugin.MojoExecutionException: Failed to clean project: Failed to delete /Users/lingxiubo/Desktop/chenyl/soft-enrol/target/soft-enrol/resource/image/login/?????? 1011_theme_asia.jpg
at org.apache.maven.plugin.clean.CleanMojo.execute(CleanMojo.java:188)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:101)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:209)
... 19 more
Caused by: java.io.IOException: Failed to delete /Users/lingxiubo/Desktop/chenyl/soft-enrol/target/soft-enrol/resource/image/login/?????? 1011_theme_asia.jpg
at org.apache.maven.plugin.clean.Cleaner.delete(Cleaner.java:227)
at org.apache.maven.plugin.clean.Cleaner.delete(Cleaner.java:186)
at org.apache.maven.plugin.clean.Cleaner.delete(Cleaner.java:154)
at org.apache.maven.plugin.clean.Cleaner.delete(Cleaner.java:154)
at org.apache.maven.plugin.clean.Cleaner.delete(Cleaner.java:154)
at org.apache.maven.plugin.clean.Cleaner.delete(Cleaner.java:154)
at org.apache.maven.plugin.clean.Cleaner.delete(Cleaner.java:154)
at org.apache.maven.plugin.clean.Cleaner.delete(Cleaner.java:115)
at org.apache.maven.plugin.clean.CleanMojo.execute(CleanMojo.java:168)
... 21 more
[ERROR]
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException
But when I use the terminal operation mvn clean
, it works.
The Maven Clean Plugin, as the name implies, attempts to clean the files and directories generated by Maven during its build. While there are plugins that generate additional files, the Clean Plugin assumes that these files are generated inside the target directory.
mvn clean install is the command to do just that. You are calling the mvn executable, which means you need Maven installed on your machine. (see How do you install Maven?) You are using the clean command, which will delete all previously compiled Java .
mvn clean: Cleans the project and removes all files generated by the previous build. mvn compile: Compiles source code of the project. mvn test-compile: Compiles the test source code. mvn test: Runs tests for the project.
Class MojoExecutionExceptionAn exception occurring during the execution of a plugin. Throwing this exception causes a "BUILD ERROR" message to be displayed.
It looks like there is a symlink in your project which eclipse cannot delete ( search the above for 'dangling symlink') . Try deleting the file manually once and also check it's permissions.
From command line which user do you run 'mvn clean' as ?
By the 'file' I mean the jpg file listed just before the clean fails.
Failed to clean project: Failed to delete /Users/lingxiubo/Desktop/chenyl/soft-enrol/target/soft-enrol/resource/image/login/?????? 1011_theme_asia.jpg
Update
Finally, it turned out that there were some special characters in one of the file names which were causing Eclipse' maven to hiccup.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With