Issue
I often getting the following error when compiling a maven project with NetBeans:
Failed to execute goal org.apache.maven.plugins:maven-install-plugin:2.3.1:install (default-install) on project xxx: Failed to install artifact yyyy: C:\...\.m2\repository\...\yyyy-1.0.0.jar (Access is denied) -> [Help 1]
I don't know what is causing it. Solution is to erase the problematic .m2 content manually and the issue goes. But it is annoying.
Anyone has a permanent solution?
EDIT
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-install-plugin:2.3.1:install (default-install) on project Plasma: Failed to install artifact net.dwst:Plasma:jar:1.0.0: C:....m2\repository\net\dwst\Plasma\1.0.0\Plasma-1.0.0.jar (Access is denied) -> [Help 1] org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.apache.maven.plugins:maven-install-plugin:2.3.1:install (default-install) on project Plasma: Failed to install artifact net.dwst:Plasma:jar:1.0.0: C:....m2\repository\net\dwst\Plasma\1.0.0\Plasma-1.0.0.jar (Access is denied) at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:203) at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:148) at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:140) 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:316) at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:153) at org.apache.maven.cli.MavenCli.execute(MavenCli.java:451) at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:188) at org.apache.maven.cli.MavenCli.main(MavenCli.java:134) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) 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 install artifact net.dwst:Plasma:jar:1.0.0: C:....m2\repository\net\dwst\Plasma\1.0.0\Plasma-1.0.0.jar (Access is denied) at org.apache.maven.plugin.install.InstallMojo.execute(InstallMojo.java:139) at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:107) at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:195) ... 19 more Caused by: org.apache.maven.artifact.installer.ArtifactInstallationException: Failed to install artifact net.dwst:Plasma:jar:1.0.0: C:....m2\repository\net\dwst\Plasma\1.0.0\Plasma-1.0.0.jar (Access is denied) at org.apache.maven.artifact.installer.DefaultArtifactInstaller.install(DefaultArtifactInstaller.java:110) at org.apache.maven.plugin.install.InstallMojo.execute(InstallMojo.java:103) ... 21 more Caused by: org.sonatype.aether.installation.InstallationException: Failed to install artifact net.dwst:Plasma:jar:1.0.0: C:....m2\repository\net\dwst\Plasma\1.0.0\Plasma-1.0.0.jar (Access is denied) at org.sonatype.aether.impl.internal.DefaultInstaller.install(DefaultInstaller.java:279) at org.sonatype.aether.impl.internal.DefaultInstaller.install(DefaultInstaller.java:190) at org.sonatype.aether.impl.internal.DefaultRepositorySystem.install(DefaultRepositorySystem.java:322) at org.apache.maven.artifact.installer.DefaultArtifactInstaller.install(DefaultArtifactInstaller.java:106) ... 22 more Caused by: java.io.FileNotFoundException: C:....m2\repository\net\dwst\Plasma\1.0.0\Plasma-1.0.0.jar (Access is denied) at java.io.FileOutputStream.open(Native Method) at java.io.FileOutputStream.(FileOutputStream.java:179) at java.io.FileOutputStream.(FileOutputStream.java:131) at org.sonatype.aether.impl.internal.DefaultFileProcessor.copy(DefaultFileProcessor.java:120) at org.sonatype.aether.impl.internal.DefaultInstaller.install(DefaultInstaller.java:255) ... 25 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
Solution
This issue started to happen after a NetBeans crash. I finally deleted the content of .m2 and re-installed NetBeans from scratch. The issue disappeared. I am still unclear what would cause it, but it is now gone.
Answered By - Jérôme Verstrynge
Answer Checked By - Clifford M. (JavaFixing Volunteer)