Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Failed to execute goal ... maven-install-plugin ... Failed to install artifact ... (Access is denied)

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

like image 715
Jérôme Verstrynge Avatar asked Apr 27 '11 00:04

Jérôme Verstrynge


1 Answers

You may have a typo in your -Dfile argument. Make sure it's pointing to an actual file, not a folder.

I.e. Make sure you don't have -Dfile=C:\lib\jackson when you mean -Dfile=C:\lib\jackson.jar


Targeting a folder can cause this "Access Denied" error, which doesn't seem to make sense for what the actual problem is.

like image 146
Don Cheadle Avatar answered Sep 18 '22 15:09

Don Cheadle