Maven Integration for Eclipse

Infinite loop when using mirrors in settings.xml

Details

  • Type: Bug Bug
  • Status: Closed Closed
  • Priority: Critical Critical
  • Resolution: Cannot Reproduce
  • Affects Version/s: None
  • Fix Version/s: None
  • Component/s: None
  • Labels:
    None
  • Number of attachments :
    2

Description

If you have a mirrors section in your.m2/ settings.xml the plugin will loop infinitely when downloading jars not in your local repository.

This is due to a wagon bug (I have logged this as http://jira.codehaus.org/browse/WAGON-73).

I was able to fix by:
Checkout https://svn.apache.org/repos/asf/maven/wagon
Applying the suggested fixes (see WAGON-73)
Recompile (mvn install)
Copy target/classes/org/apache/maven/wagon/manager/MirroredWagon.class into maven-embedder-2.1.0.v20070221-2149-dep.jar

I could not work out how to rebuild the entire maven-embedder from source.

Issue Links

Activity

Hide
Eugene Kuleshov added a comment -

Please try with 0.0.11 dev build and if it is still there, provide settings.xml as well as complete sample project that would allow to reproduce this issue.

Show
Eugene Kuleshov added a comment - Please try with 0.0.11 dev build and if it is still there, provide settings.xml as well as complete sample project that would allow to reproduce this issue.
Hide
Phillip Webb added a comment -

Sorry, still there with the latest code.

To replicate:

You need a settings.xml with a mirror setup, this will do

<settings>

<mirrors>

<mirror>

<id>maven-proxy</id>

<name>Maven-Proxy Mirror</name>

<url>http://maven2.mirrors.skynet.be/pub/maven2/</url>

<mirrorOf>central</mirrorOf>

</mirror>

</mirrors>

</settings>

Start the plugin so that you can debug it.

Create a new java project, call it test.

Maven enable the project that you have just created, the defaults are fine.

Open the POM file.

In the eclipse that is running the plugin add a beakpoint at line 360 of MavenModelManager, the line that reads:
return mavenEmbedder.readProjectWithDependencies(request);

Go back to you POM file and right click, choose Maven, Add Dependency

If you hit the breakpoint before selecting the dependency just continue.

Choose a dependency that you do not have in your local repository, I choose commons-digester 1.2

You should hit your breakpoint now, note the Thread name and just continue.

This should put you into the infinite loop.

If you pause the thread that you noted earlier should should find a call stack that includes MirroredWagon.connect(). I am 99% sure this is the cause of the problem.

The source for MirroredWagon is not included in the workspace but you can get it from here: https://svn.apache.org/repos/asf/maven/wagon/trunk/wagon-manager/

Stick a breakpoint on the connect method and you will see where the infinite loop is happening.

I will add a patch to WAGON-73. Perhaps you could confirm the bug and add a comment to WAGON-73 as so far I have not had much of a response.

Show
Phillip Webb added a comment - Sorry, still there with the latest code. To replicate: You need a settings.xml with a mirror setup, this will do <settings> <mirrors> <mirror> <id>maven-proxy</id> <name>Maven-Proxy Mirror</name> <url>http://maven2.mirrors.skynet.be/pub/maven2/</url> <mirrorOf>central</mirrorOf> </mirror> </mirrors> </settings> Start the plugin so that you can debug it. Create a new java project, call it test. Maven enable the project that you have just created, the defaults are fine. Open the POM file. In the eclipse that is running the plugin add a beakpoint at line 360 of MavenModelManager, the line that reads: return mavenEmbedder.readProjectWithDependencies(request); Go back to you POM file and right click, choose Maven, Add Dependency If you hit the breakpoint before selecting the dependency just continue. Choose a dependency that you do not have in your local repository, I choose commons-digester 1.2 You should hit your breakpoint now, note the Thread name and just continue. This should put you into the infinite loop. If you pause the thread that you noted earlier should should find a call stack that includes MirroredWagon.connect(). I am 99% sure this is the cause of the problem. The source for MirroredWagon is not included in the workspace but you can get it from here: https://svn.apache.org/repos/asf/maven/wagon/trunk/wagon-manager/ Stick a breakpoint on the connect method and you will see where the infinite loop is happening. I will add a patch to WAGON-73. Perhaps you could confirm the bug and add a comment to WAGON-73 as so far I have not had much of a response.
Hide
Phillip Webb added a comment -

Attached settings.xml for you

Show
Phillip Webb added a comment - Attached settings.xml for you
Hide
Thorsten Kamann added a comment -

This is the Maven-Embedder with the patch enabled. Now mirrors can be used.

Show
Thorsten Kamann added a comment - This is the Maven-Embedder with the patch enabled. Now mirrors can be used.
Hide
Mauritz Lovgren added a comment -

The new embedder seems to solve the problem for the Maven project builder.

The problem is till present when building using a 'Run as Maven..' configuration though.
Very similar behaviour as with the project builder; when an artifact is not located in the local repository the build goes into a loop that consumes 100% cpu.

Show
Mauritz Lovgren added a comment - The new embedder seems to solve the problem for the Maven project builder. The problem is till present when building using a 'Run as Maven..' configuration though. Very similar behaviour as with the project builder; when an artifact is not located in the local repository the build goes into a loop that consumes 100% cpu.
Hide
Eugene Kuleshov added a comment -

Can't reproduce this with the latest embedder. Please try this when 0.0.12 version release and reopen if this problem is still there. Thanks.

Show
Eugene Kuleshov added a comment - Can't reproduce this with the latest embedder. Please try this when 0.0.12 version release and reopen if this problem is still there. Thanks.

People

Vote (4)
Watch (2)

Dates

  • Created:
    Updated:
    Resolved: