Maven Integration for Eclipse

File not found - target/classes access denied

Details

  • Type: Bug Bug
  • Status: Open Open
  • Priority: Major Major
  • Resolution: Unresolved
  • Affects Version/s: None
  • Fix Version/s: None
  • Component/s: Maven Launcher
  • Labels:
    None
  • Environment:
    Eclipse 3.4.1, Maven Integration for Eclipse 0.9.7
  • Number of attachments :
    1

Description

When running "Maven install" on a project which depends on another which depends on another one it looks like maven plugin is locking the "target/classes" folder into the dependant project, it works perfectly with the previous (0.9.6) version of m2 plugin. Probably it is happening with all nested projects because the ones that aren't nested are working great.

If you need more information about this bug just tell me. I've been searching all over Internet and I am not the only one who is suffering this bug but it seems they haven't realized yet that it is a matter of your last version only.

The error the plugin sends:
Embedded error: {projectPath}\target\classes (Access denied)

And here it goes the trace running maven install with -e option:
[INFO] Trace
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to copy file for artifact[org.gobiernodecanarias.ceh.controlAcceso:controlAcceso-core:jar:1.0-SNAPSHOT:compile]
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:583)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalWithLifecycle(DefaultLifecycleExecutor.java:499)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoal(DefaultLifecycleExecutor.java:478)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalAndHandleFailures(DefaultLifecycleExecutor.java:330)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeTaskSegments(DefaultLifecycleExecutor.java:291)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLifecycleExecutor.java:142)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:336)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:129)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:287)
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.classworlds.Launcher.launchEnhanced(Launcher.java:315)
at org.codehaus.classworlds.Launcher.launch(Launcher.java:255)
at org.codehaus.classworlds.Launcher.mainWithExitCode(Launcher.java:430)
at org.codehaus.classworlds.Launcher.main(Launcher.java:375)
Caused by: org.apache.maven.plugin.MojoExecutionException: Failed to copy file for artifact[controlAcceso:controlAcceso-core:jar:1.0-SNAPSHOT:compile]
at org.apache.maven.plugin.war.packaging.ArtifactsPackagingTask.performPackaging(ArtifactsPackagingTask.java:99)
at org.apache.maven.plugin.war.packaging.WarProjectPackagingTask.handleArtifacts(WarProjectPackagingTask.java:151)
at org.apache.maven.plugin.war.packaging.WarProjectPackagingTask.performPackaging(WarProjectPackagingTask.java:72)
at org.apache.maven.plugin.war.AbstractWarMojo.buildWebapp(AbstractWarMojo.java:364)
at org.apache.maven.plugin.war.AbstractWarMojo.buildExplodedWebapp(AbstractWarMojo.java:317)
at org.apache.maven.plugin.war.WarMojo.performPackaging(WarMojo.java:166)
at org.apache.maven.plugin.war.WarMojo.execute(WarMojo.java:130)
at org.apache.maven.plugin.DefaultPluginManager.executeMojo(DefaultPluginManager.java:451)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:558)
... 16 more
Caused by: java.io.FileNotFoundException: C:\Java\proyectos\controlAcceso\controlAcceso-core\target\classes (Acceso denegado)
at java.io.FileInputStream.open(Native Method)
at java.io.FileInputStream.<init>(FileInputStream.java:106)
at org.codehaus.plexus.util.FileUtils.copyFile(FileUtils.java:929)
at org.apache.maven.plugin.war.packaging.AbstractWarPackagingTask.copyFile(AbstractWarPackagingTask.java:304)
at org.apache.maven.plugin.war.packaging.AbstractWarPackagingTask$1.alreadyRegistered(AbstractWarPackagingTask.java:151)
at org.apache.maven.plugin.war.util.WebappStructure.registerFile(WebappStructure.java:118)
at org.apache.maven.plugin.war.packaging.AbstractWarPackagingTask.copyFile(AbstractWarPackagingTask.java:140)
at org.apache.maven.plugin.war.packaging.ArtifactsPackagingTask.performPackaging(ArtifactsPackagingTask.java:76)
... 24 more

Issue Links

Activity

Hide
Oliver Waeldrich added a comment - - edited

I have the same problem when executing the Maven War-Plugin within a multi-module project. The error occurs when using an external Maven installation. This seems to work with the embedded installation.

Show
Oliver Waeldrich added a comment - - edited I have the same problem when executing the Maven War-Plugin within a multi-module project. The error occurs when using an external Maven installation. This seems to work with the embedded installation.
Hide
Philip Wilder added a comment -

Same issue (version and everything), although unfortunately I switched to an external maven installation to circumvent other issues so going back is not an option. It would be nice if an 0.9.6 update site were made available again as an interim solution.

Show
Philip Wilder added a comment - Same issue (version and everything), although unfortunately I switched to an external maven installation to circumvent other issues so going back is not an option. It would be nice if an 0.9.6 update site were made available again as an interim solution.
Hide
Francisco Tena added a comment - - edited

Hi Philip I solved it in the meantime using the previous version of the plugin. I have it zipped so if you need it I can send you the zip file so you only need to unzip it on your features and plugin directories. Alternatively I guess you can define on your pom.xml the version of the plugin you want to use.

regards

Show
Francisco Tena added a comment - - edited Hi Philip I solved it in the meantime using the previous version of the plugin. I have it zipped so if you need it I can send you the zip file so you only need to unzip it on your features and plugin directories. Alternatively I guess you can define on your pom.xml the version of the plugin you want to use. regards
Hide
Philip Wilder added a comment -

Hi Francisco,

I'm not sure this issue can be solved by changing plugin version values as the problem seems to be with M2Eclipse (no issues when I run from the cmdline). If you can easily attach a 0.9.6 M2Eclipse version to this issue I would encourage your to do so as it would help both me and potentially other people out there suffering from this issue in silence.

Thanks,

Philip

Show
Philip Wilder added a comment - Hi Francisco, I'm not sure this issue can be solved by changing plugin version values as the problem seems to be with M2Eclipse (no issues when I run from the cmdline). If you can easily attach a 0.9.6 M2Eclipse version to this issue I would encourage your to do so as it would help both me and potentially other people out there suffering from this issue in silence. Thanks, Philip
Hide
Eugene Kuleshov added a comment - - edited

Guys, what changed between 0.9.6 and 0.9.7 is that now predefined Maven launch shortcuts are using the project preferences for resolving artifacts from workspace. E.g. if project have the workspace dependency resolution enabled, these launch shortcuts will also have it enabled. Right now there is no option to disable that, however you can either disable workspace resolution in the project settings or create Maven launch configuration and explicitly disable workspace resolution in that configuration.

This was done in an attempt to make things launched from within Eclipse (e.g. JUnit tests or Java app using standard Eclipse launch configuration) and Maven launch configuration consistent (i.e. use the same dependencies). Otherwise you have to explicitly install all required dependencies into the local Maven repository.

Unfortunately, as you've noticed not all Maven plugins can cope with workspace resolution. So, the error you see is mean that plugin got the folder that contains the classes while expecting to see the jar file.

The only alternative solution I can think of is to install all artifacts present in the Eclipse workspace into the Maven repository, so command line will always use up to date code, but obviously will slow down things a little.

Show
Eugene Kuleshov added a comment - - edited Guys, what changed between 0.9.6 and 0.9.7 is that now predefined Maven launch shortcuts are using the project preferences for resolving artifacts from workspace. E.g. if project have the workspace dependency resolution enabled, these launch shortcuts will also have it enabled. Right now there is no option to disable that, however you can either disable workspace resolution in the project settings or create Maven launch configuration and explicitly disable workspace resolution in that configuration. This was done in an attempt to make things launched from within Eclipse (e.g. JUnit tests or Java app using standard Eclipse launch configuration) and Maven launch configuration consistent (i.e. use the same dependencies). Otherwise you have to explicitly install all required dependencies into the local Maven repository. Unfortunately, as you've noticed not all Maven plugins can cope with workspace resolution. So, the error you see is mean that plugin got the folder that contains the classes while expecting to see the jar file. The only alternative solution I can think of is to install all artifacts present in the Eclipse workspace into the Maven repository, so command line will always use up to date code, but obviously will slow down things a little.
Hide
Francisco Tena added a comment -

Hi guys in the case you need to rollbak to 0.9.6 version here are the files,

Under eclipse 3.4.2 just unzip plugins.zip.x into your plugins directory and the same with features.zip to get your 0.9.6 version of the m2eclipse plugin. Make sure your previous installation of m2eclipse is removed. You can try it into an alternative installation of Eclipse and if it works install it into your working eclipse.

hope it helps

PD: as far as the zipped file doesnt fit 10M I am going to break them into the next files

plugins.zip.001
plugins.zip.002
features.zip

Show
Francisco Tena added a comment - Hi guys in the case you need to rollbak to 0.9.6 version here are the files, Under eclipse 3.4.2 just unzip plugins.zip.x into your plugins directory and the same with features.zip to get your 0.9.6 version of the m2eclipse plugin. Make sure your previous installation of m2eclipse is removed. You can try it into an alternative installation of Eclipse and if it works install it into your working eclipse. hope it helps PD: as far as the zipped file doesnt fit 10M I am going to break them into the next files plugins.zip.001 plugins.zip.002 features.zip
Hide
Francisco Tena added a comment -

Hi guys in the case you need to rollbak to 0.9.6 version here are the files,

Under eclipse 3.4.2 just unzip plugins.zip.x into your plugins directory and the same with features.zip to get your 0.9.6 version of the m2eclipse plugin. Make sure your previous installation of m2eclipse is removed. You can try it into an alternative installation of Eclipse and if it works install it into your working eclipse.

hope it helps

PD: as far as the zipped file doesnt fit 10M I am going to break them into the next files

plugins.zip.001
plugins.zip.002
features.zip

Show
Francisco Tena added a comment - Hi guys in the case you need to rollbak to 0.9.6 version here are the files, Under eclipse 3.4.2 just unzip plugins.zip.x into your plugins directory and the same with features.zip to get your 0.9.6 version of the m2eclipse plugin. Make sure your previous installation of m2eclipse is removed. You can try it into an alternative installation of Eclipse and if it works install it into your working eclipse. hope it helps PD: as far as the zipped file doesnt fit 10M I am going to break them into the next files plugins.zip.001 plugins.zip.002 features.zip
Hide
Todd Thiessen added a comment -

Eugene.

I get this error even if all artifacts are installed in my local repository.

Show
Todd Thiessen added a comment - Eugene. I get this error even if all artifacts are installed in my local repository.
Hide
Todd Thiessen added a comment - - edited

Let me correct my last comment.

When creating a new run configuration the "Resolve Workspace Artifacts" checkbox is NOT checked if you create the run config from the "Run Configurations..." dialog. However, if you create your run configuration from the "Maven Build..." dialog, this option is checked by default. We observed different behavior but I incorrectly assumed that the default option for "Resolve Workspace Artifacts" was checked when creating it through the new "Run Configuration" dialog.

However, I still get this error even when all artifacts are installed to my local repo and with "Resolved Workspace Artifacts" checked.

Show
Todd Thiessen added a comment - - edited Let me correct my last comment. When creating a new run configuration the "Resolve Workspace Artifacts" checkbox is NOT checked if you create the run config from the "Run Configurations..." dialog. However, if you create your run configuration from the "Maven Build..." dialog, this option is checked by default. We observed different behavior but I incorrectly assumed that the default option for "Resolve Workspace Artifacts" was checked when creating it through the new "Run Configuration" dialog. However, I still get this error even when all artifacts are installed to my local repo and with "Resolved Workspace Artifacts" checked.
Hide
Eugene Kuleshov added a comment -

Todd, this is consistent with the explanation from my last comment. To force resolving artifact from your local Maven repository you should uncheck "resolve workspace artifacts" setting in the Maven launch configuration dialog.

Show
Eugene Kuleshov added a comment - Todd, this is consistent with the explanation from my last comment. To force resolving artifact from your local Maven repository you should uncheck "resolve workspace artifacts" setting in the Maven launch configuration dialog.
Hide
Eugene Kuleshov added a comment -

Francisco, please don't do this. The issue tracking system is NOT supposed to be used as a file sharing service.

All previous m2eclipse releases are available from the update site at http://m2eclipse.sonatype.org/update/ You just need to uncheck "show only latest version" option in the update manager UI. Then it will show you all the version and you can select ones you want to install.

Show
Eugene Kuleshov added a comment - Francisco, please don't do this. The issue tracking system is NOT supposed to be used as a file sharing service. All previous m2eclipse releases are available from the update site at http://m2eclipse.sonatype.org/update/ You just need to uncheck "show only latest version" option in the update manager UI. Then it will show you all the version and you can select ones you want to install.
Hide
Philip Wilder added a comment -

"You just need to uncheck "show only latest version..."

This is a good idea Eugene and I was unaware of this feature but even after doing this I still only see version 0.9.7. I'll attempt to post a screenshot to show you what I am seeing.

Show
Philip Wilder added a comment - "You just need to uncheck "show only latest version..." This is a good idea Eugene and I was unaware of this feature but even after doing this I still only see version 0.9.7. I'll attempt to post a screenshot to show you what I am seeing.
Hide
Philip Wilder added a comment - - edited

Demonstrating that I am unable to see multiple M2Eclipse download versions. (See image attachements SingleVersion.jpg).

Show
Philip Wilder added a comment - - edited Demonstrating that I am unable to see multiple M2Eclipse download versions. (See image attachements SingleVersion.jpg).
Hide
Francisco Tena added a comment -

Sorry Eugene, I didn't realize about that checkbox, my fault. Thanks for the tip !

Show
Francisco Tena added a comment - Sorry Eugene, I didn't realize about that checkbox, my fault. Thanks for the tip !
Hide
Eugene Kuleshov added a comment -

Philip, try update site at http://m2eclipse.sonatype.org/update/site.xml
Please also report this to the mailing list about this issue and ask Sonatype folks to fix the p2 metadata for the main update site.

Show
Eugene Kuleshov added a comment - Philip, try update site at http://m2eclipse.sonatype.org/update/site.xml Please also report this to the mailing list about this issue and ask Sonatype folks to fix the p2 metadata for the main update site.

People

Vote (41)
Watch (35)

Dates

  • Created:
    Updated: