Maven Integration for Eclipse

[mng] Workspace dependency resolution doesn't work with maven-dependency-plugin

Details

  • Type: Bug Bug
  • Status: Open Open
  • Priority: Major Major
  • Resolution: Unresolved
  • Affects Version/s: None
  • Fix Version/s: None
  • Component/s: Help Wanted, Maven Embedder
  • Labels:
    None
  • Environment:
    Windows XP SP2, Eclipse 3.4.1, external maven 2.0.9
  • Testcase included:
    yes
  • Number of attachments :
    6

Description

When we enable "Resolve dependencies from workspace projects", maven-dependency-plugin doesn't find its dependencies anymore, and fails with an "internal error". You can only see this error if you use the debug option "-X".

I attached two pom files which describes two projects :

  • projet1 is a very simple jar project
  • projet2 depends on projet1 and uses the "copy" goal of maven-dependency-project to copy this dependency.

Issue Links

Activity

Hide
Julien Wajsberg added a comment -

Attached the testcase

Show
Julien Wajsberg added a comment - Attached the testcase
Hide
Eugene Kuleshov added a comment -

Julien, does this happen only when launching Maven? Can you please provide the stack trace you are seeing. Thanks.

BTW, it would make easier for us to use your test poms if you had provided complete projects in an archive, so we could just import those projects here without intermediate steps.

Show
Eugene Kuleshov added a comment - Julien, does this happen only when launching Maven? Can you please provide the stack trace you are seeing. Thanks. BTW, it would make easier for us to use your test poms if you had provided complete projects in an archive, so we could just import those projects here without intermediate steps.
Hide
Julien Wajsberg added a comment -

Attach complete projects

Show
Julien Wajsberg added a comment - Attach complete projects
Hide
Julien Wajsberg added a comment -

> Julien, does this happen only when launching Maven? Can you please provide the stack trace you are seeing. Thanks.

Sorry, I don't understand the first question.

For the stack trace, I can't because it isn't written on the console, even with -X... Is there a way to display it ?

Show
Julien Wajsberg added a comment - > Julien, does this happen only when launching Maven? Can you please provide the stack trace you are seeing. Thanks. Sorry, I don't understand the first question. For the stack trace, I can't because it isn't written on the console, even with -X... Is there a way to display it ?
Hide
Eugene Kuleshov added a comment -

> > Julien, does this happen only when launching Maven? Can you please provide the
> stack trace you are seeing. Thanks.
> Sorry, I don't understand the first question.

There is several cases when m2eclipse can execute Maven:

  • launching Maven using Run As... / Maven xxx
  • Maven builder runs goals specified on Maven page in project properties
  • Maven project import and update configuration runs goals specified on Maven preference page in Window / Preferences / Maven
  • update dependencies also delegate to Maven to read project

You need to be very specific about what action caused error you are seeing.

> For the stack trace, I can't because it isn't written on the console, even with
> -X... Is there a way to display it ?

So, there is nothing goes to the Eclipse error log?
There is a -console option in Eclipse command line and you can also explicitly specify to use java.exe instead of javaw.exe in eclipse.ini. Something like this:

-startup
plugins\org.eclipse.equinox.launcher_1.0.100.v20080509-1800.jar
--launcher.library
plugins\org.eclipse.equinox.launcher.win32.win32.x86_1.0.100.v20080509-1800
-showsplash
org.eclipse.platform
-vm
C:\jdk1.6.0_06\bin\java.exe
-vmargs
-Xms256m
-Xmx500m
-XX:PermSize=32m
-XX:MaxPermSize=256m
Show
Eugene Kuleshov added a comment - > > Julien, does this happen only when launching Maven? Can you please provide the > stack trace you are seeing. Thanks. > Sorry, I don't understand the first question. There is several cases when m2eclipse can execute Maven:
  • launching Maven using Run As... / Maven xxx
  • Maven builder runs goals specified on Maven page in project properties
  • Maven project import and update configuration runs goals specified on Maven preference page in Window / Preferences / Maven
  • update dependencies also delegate to Maven to read project
You need to be very specific about what action caused error you are seeing. > For the stack trace, I can't because it isn't written on the console, even with > -X... Is there a way to display it ? So, there is nothing goes to the Eclipse error log? There is a -console option in Eclipse command line and you can also explicitly specify to use java.exe instead of javaw.exe in eclipse.ini. Something like this:
-startup
plugins\org.eclipse.equinox.launcher_1.0.100.v20080509-1800.jar
--launcher.library
plugins\org.eclipse.equinox.launcher.win32.win32.x86_1.0.100.v20080509-1800
-showsplash
org.eclipse.platform
-vm
C:\jdk1.6.0_06\bin\java.exe
-vmargs
-Xms256m
-Xmx500m
-XX:PermSize=32m
-XX:MaxPermSize=256m
Hide
Julien Wajsberg added a comment - - edited

Originally, we trigger this bug using "clean" from menu "Project" in Eclipse. This clean triggers "process-test-resources" on the project, because of the maven configuration for this project.

Using this way doesn't show any stacktrace, just a message "Internal error in the plugin manager executing goal 'org.apache.maven.plugins:maven-dependency-plugin:2.0-alpha-4:copy': Mojo execution failed."

I tried now to directly launch the goal "process-test-resources" from a Maven run configuration. The bug didn't show up first. But then, I check "Resolve workspace artifacts", the bug is back ! And this time I have the stack trace (note "Accès refusé" is french for "Access Forbidden") :

The following mojo encountered an error while executing:
Group-Id: org.apache.maven.plugins
Artifact-Id: maven-dependency-plugin
Version: 2.0-alpha-4
Mojo: copy
brought in via: POM

While building project:
Group-Id: com.developpez
Artifact-Id: projet2
Version: 0.0.1-SNAPSHOT
From file: C:\OmarH\workspace\projet2\pom.xml
Reason: Error copying artifact 
  from C:\OmarH\workspace\projet1\target\classes 
  to C:\OmarH\workspace\projet2\target\copied-files\classes

java.io.FileNotFoundException: C:\OmarH\workspace\projet1\target\classes (Accès refusé)
	at java.io.FileInputStream.open(Native Method)
	at java.io.FileInputStream.<init>(FileInputStream.java:106)
	at org.codehaus.plexus.util.FileUtils.copyFile(FileUtils.java:820)
	at org.apache.maven.plugin.dependency.AbstractDependencyMojo.copyFile(AbstractDependencyMojo.java:194)
	at org.apache.maven.plugin.dependency.fromConfiguration.CopyMojo.copyArtifact(CopyMojo.java:98)
	at org.apache.maven.plugin.dependency.fromConfiguration.CopyMojo.execute(CopyMojo.java:72)
	at org.apache.maven.plugin.DefaultPluginManager.executeMojo(DefaultPluginManager.java:579)
	at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalAndHandleFailures(DefaultLifecycleExecutor.java:498)
	at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeTaskSegmentForProject(DefaultLifecycleExecutor.java:265)
	at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeTaskSegments(DefaultLifecycleExecutor.java:191)
	at org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLifecycleExecutor.java:149)
	at org.apache.maven.DefaultMaven.execute_aroundBody0(DefaultMaven.java:223)
	at org.apache.maven.DefaultMaven.execute_aroundBody1$advice(DefaultMaven.java:304)
	at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:1)
	at org.apache.maven.embedder.MavenEmbedder.execute_aroundBody2(MavenEmbedder.java:904)
	at org.apache.maven.embedder.MavenEmbedder.execute_aroundBody3$advice(MavenEmbedder.java:304)
	at org.apache.maven.embedder.MavenEmbedder.execute(MavenEmbedder.java:1)
	at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:176)
	at org.apache.maven.cli.MavenCli.main(MavenCli.java:63)
	at org.apache.maven.cli.MavenCli.main(MavenCli.java:52)

Error stacktrace:
org.apache.maven.lifecycle.LifecycleExecutionException: 
  Internal error in the plugin manager executing goal 
  'org.apache.maven.plugins:maven-dependency-plugin:2.0-alpha-4:copy': Mojo execution failed.
	at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalAndHandleFailures(DefaultLifecycleExecutor.java:505)
	at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeTaskSegmentForProject(DefaultLifecycleExecutor.java:265)
	at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeTaskSegments(DefaultLifecycleExecutor.java:191)
	at org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLifecycleExecutor.java:149)
	at org.apache.maven.DefaultMaven.execute_aroundBody0(DefaultMaven.java:223)
	at org.apache.maven.DefaultMaven.execute_aroundBody1$advice(DefaultMaven.java:304)
	at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:1)
	at org.apache.maven.embedder.MavenEmbedder.execute_aroundBody2(MavenEmbedder.java:904)
	at org.apache.maven.embedder.MavenEmbedder.execute_aroundBody3$advice(MavenEmbedder.java:304)
	at org.apache.maven.embedder.MavenEmbedder.execute(MavenEmbedder.java:1)
	at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:176)
	at org.apache.maven.cli.MavenCli.main(MavenCli.java:63)
	at org.apache.maven.cli.MavenCli.main(MavenCli.java:52)
Caused by: org.apache.maven.plugin.PluginExecutionException: Mojo execution failed.
	at org.apache.maven.plugin.DefaultPluginManager.executeMojo(DefaultPluginManager.java:601)
	at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalAndHandleFailures(DefaultLifecycleExecutor.java:498)
	... 12 more
Caused by: org.apache.maven.plugin.MojoExecutionException: Error copying artifact 
  from C:\OmarH\workspace\projet1\target\classes 
  to C:\OmarH\workspace\projet2\target\copied-files\classes
	at org.apache.maven.plugin.dependency.AbstractDependencyMojo.copyFile(AbstractDependencyMojo.java:199)
	at org.apache.maven.plugin.dependency.fromConfiguration.CopyMojo.copyArtifact(CopyMojo.java:98)
	at org.apache.maven.plugin.dependency.fromConfiguration.CopyMojo.execute(CopyMojo.java:72)
	at org.apache.maven.plugin.DefaultPluginManager.executeMojo(DefaultPluginManager.java:579)
	... 13 more
Caused by: java.io.FileNotFoundException: C:\OmarH\workspace\projet1\target\classes (Accès refusé)
	at java.io.FileInputStream.open(Native Method)
	at java.io.FileInputStream.<init>(FileInputStream.java:106)
	at org.codehaus.plexus.util.FileUtils.copyFile(FileUtils.java:820)
	at org.apache.maven.plugin.dependency.AbstractDependencyMojo.copyFile(AbstractDependencyMojo.java:194)
	... 16 more

Note also that the bug is triggered both by Maven embedder and external maven, so I'm not sure it's in the correct bug category.

Show
Julien Wajsberg added a comment - - edited Originally, we trigger this bug using "clean" from menu "Project" in Eclipse. This clean triggers "process-test-resources" on the project, because of the maven configuration for this project. Using this way doesn't show any stacktrace, just a message "Internal error in the plugin manager executing goal 'org.apache.maven.plugins:maven-dependency-plugin:2.0-alpha-4:copy': Mojo execution failed." I tried now to directly launch the goal "process-test-resources" from a Maven run configuration. The bug didn't show up first. But then, I check "Resolve workspace artifacts", the bug is back ! And this time I have the stack trace (note "Accès refusé" is french for "Access Forbidden") :
The following mojo encountered an error while executing:
Group-Id: org.apache.maven.plugins
Artifact-Id: maven-dependency-plugin
Version: 2.0-alpha-4
Mojo: copy
brought in via: POM

While building project:
Group-Id: com.developpez
Artifact-Id: projet2
Version: 0.0.1-SNAPSHOT
From file: C:\OmarH\workspace\projet2\pom.xml
Reason: Error copying artifact 
  from C:\OmarH\workspace\projet1\target\classes 
  to C:\OmarH\workspace\projet2\target\copied-files\classes

java.io.FileNotFoundException: C:\OmarH\workspace\projet1\target\classes (Accès refusé)
	at java.io.FileInputStream.open(Native Method)
	at java.io.FileInputStream.<init>(FileInputStream.java:106)
	at org.codehaus.plexus.util.FileUtils.copyFile(FileUtils.java:820)
	at org.apache.maven.plugin.dependency.AbstractDependencyMojo.copyFile(AbstractDependencyMojo.java:194)
	at org.apache.maven.plugin.dependency.fromConfiguration.CopyMojo.copyArtifact(CopyMojo.java:98)
	at org.apache.maven.plugin.dependency.fromConfiguration.CopyMojo.execute(CopyMojo.java:72)
	at org.apache.maven.plugin.DefaultPluginManager.executeMojo(DefaultPluginManager.java:579)
	at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalAndHandleFailures(DefaultLifecycleExecutor.java:498)
	at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeTaskSegmentForProject(DefaultLifecycleExecutor.java:265)
	at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeTaskSegments(DefaultLifecycleExecutor.java:191)
	at org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLifecycleExecutor.java:149)
	at org.apache.maven.DefaultMaven.execute_aroundBody0(DefaultMaven.java:223)
	at org.apache.maven.DefaultMaven.execute_aroundBody1$advice(DefaultMaven.java:304)
	at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:1)
	at org.apache.maven.embedder.MavenEmbedder.execute_aroundBody2(MavenEmbedder.java:904)
	at org.apache.maven.embedder.MavenEmbedder.execute_aroundBody3$advice(MavenEmbedder.java:304)
	at org.apache.maven.embedder.MavenEmbedder.execute(MavenEmbedder.java:1)
	at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:176)
	at org.apache.maven.cli.MavenCli.main(MavenCli.java:63)
	at org.apache.maven.cli.MavenCli.main(MavenCli.java:52)

Error stacktrace:
org.apache.maven.lifecycle.LifecycleExecutionException: 
  Internal error in the plugin manager executing goal 
  'org.apache.maven.plugins:maven-dependency-plugin:2.0-alpha-4:copy': Mojo execution failed.
	at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalAndHandleFailures(DefaultLifecycleExecutor.java:505)
	at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeTaskSegmentForProject(DefaultLifecycleExecutor.java:265)
	at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeTaskSegments(DefaultLifecycleExecutor.java:191)
	at org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLifecycleExecutor.java:149)
	at org.apache.maven.DefaultMaven.execute_aroundBody0(DefaultMaven.java:223)
	at org.apache.maven.DefaultMaven.execute_aroundBody1$advice(DefaultMaven.java:304)
	at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:1)
	at org.apache.maven.embedder.MavenEmbedder.execute_aroundBody2(MavenEmbedder.java:904)
	at org.apache.maven.embedder.MavenEmbedder.execute_aroundBody3$advice(MavenEmbedder.java:304)
	at org.apache.maven.embedder.MavenEmbedder.execute(MavenEmbedder.java:1)
	at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:176)
	at org.apache.maven.cli.MavenCli.main(MavenCli.java:63)
	at org.apache.maven.cli.MavenCli.main(MavenCli.java:52)
Caused by: org.apache.maven.plugin.PluginExecutionException: Mojo execution failed.
	at org.apache.maven.plugin.DefaultPluginManager.executeMojo(DefaultPluginManager.java:601)
	at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalAndHandleFailures(DefaultLifecycleExecutor.java:498)
	... 12 more
Caused by: org.apache.maven.plugin.MojoExecutionException: Error copying artifact 
  from C:\OmarH\workspace\projet1\target\classes 
  to C:\OmarH\workspace\projet2\target\copied-files\classes
	at org.apache.maven.plugin.dependency.AbstractDependencyMojo.copyFile(AbstractDependencyMojo.java:199)
	at org.apache.maven.plugin.dependency.fromConfiguration.CopyMojo.copyArtifact(CopyMojo.java:98)
	at org.apache.maven.plugin.dependency.fromConfiguration.CopyMojo.execute(CopyMojo.java:72)
	at org.apache.maven.plugin.DefaultPluginManager.executeMojo(DefaultPluginManager.java:579)
	... 13 more
Caused by: java.io.FileNotFoundException: C:\OmarH\workspace\projet1\target\classes (Accès refusé)
	at java.io.FileInputStream.open(Native Method)
	at java.io.FileInputStream.<init>(FileInputStream.java:106)
	at org.codehaus.plexus.util.FileUtils.copyFile(FileUtils.java:820)
	at org.apache.maven.plugin.dependency.AbstractDependencyMojo.copyFile(AbstractDependencyMojo.java:194)
	... 16 more
Note also that the bug is triggered both by Maven embedder and external maven, so I'm not sure it's in the correct bug category.
Hide
Eugene Kuleshov added a comment -

Can you please attach your Eclipse configuration details from Help / About Eclipse SDK / Configuration Details?
Error like access forbidden probably mean that there is something with permissions on the file system. I would suggest to try to use clean checkout for that project or try this on a different machine.

Show
Eugene Kuleshov added a comment - Can you please attach your Eclipse configuration details from Help / About Eclipse SDK / Configuration Details? Error like access forbidden probably mean that there is something with permissions on the file system. I would suggest to try to use clean checkout for that project or try this on a different machine.
Hide
Julien Wajsberg added a comment -

We encounter the very same problem on 3 different machines already.

Here are the configurations for all 3 machines.

Show
Julien Wajsberg added a comment - We encounter the very same problem on 3 different machines already. Here are the configurations for all 3 machines.
Hide
Vitaly Polonetsky added a comment -

Just wanted to comment about a "workaround" in my opinion.
I had the same issue, but running the build with install goal solves it, because the dependencies are installed into the repository and brought up from the repository and not the workspace.

Show
Vitaly Polonetsky added a comment - Just wanted to comment about a "workaround" in my opinion. I had the same issue, but running the build with install goal solves it, because the dependencies are installed into the repository and brought up from the repository and not the workspace.
Hide
Igor Fedorenko added a comment -

As far as I know, recently released maven-dependency-plugin 2.1 contains a fix for the root cause of the problem. See MDEP-187 .

Show
Igor Fedorenko added a comment - As far as I know, recently released maven-dependency-plugin 2.1 contains a fix for the root cause of the problem. See MDEP-187 .

People

Vote (12)
Watch (12)

Dates

  • Created:
    Updated: