[ 
https://jira.codehaus.org/browse/MSITE-640?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=326248#comment-326248
 ] 

Michael Koch commented on MSITE-640:
------------------------------------

I also spent some time debugging the code, here are my findings:

bq. the root cause seemed to be that the site plugin wasn't giving Maven the 
full list of repositories to search.

I don't think the site plugin ({{DefaultSiteTool.populateModulesMenu}} from 
_doxia-integration-tools_) can pass the list of repositories because the 
{{MavenProjectBuilder}} interface has no method which accepts a POM file and a 
list of repositories. I guess adding one would be counter-productive since the 
interface is deprecated.

My idea would be to fix the repository list resolution of the 
{{DefaultMavenProjectBuilder}} in _maven-compat_. As far as I can see by 
debugging, the problem is that the list of profiles (including the profile from 
the settings.xml which declares the required repository) is not copied from the 
{{legacySupport MavenSession}} to the {{ProjectBuildingRequest request}}. 
Therefore, even though the request contains the list of active profile IDs, the 
profile corresponding to the ID cannot be found.

The issue can be fixed by copying the profiles in 
{{DefaultMavenProjectBuilder.injectSession}}.

{noformat}
diff --git 
a/maven-compat/src/main/java/org/apache/maven/project/DefaultMavenProjectBuilder.java
 b/maven-compat/src/main
index fff2de1..fdb18ec 100644
--- 
a/maven-compat/src/main/java/org/apache/maven/project/DefaultMavenProjectBuilder.java
+++ 
b/maven-compat/src/main/java/org/apache/maven/project/DefaultMavenProjectBuilder.java
@@ -124,6 +124,7 @@ public class DefaultMavenProjectBuilder
             if ( req != null )
             {
                 request.setRemoteRepositories( req.getRemoteRepositories() );
+                request.setProfiles(req.getProfiles());
             }
         }
         else
{noformat}

This fixes the issue with site creation for me. However, I am not sure if this 
change does not break other things. Could someone experienced with this part of 
the Maven core have a look at it?
                
> Maven searches only central repository for imported dependencies
> ----------------------------------------------------------------
>
>                 Key: MSITE-640
>                 URL: https://jira.codehaus.org/browse/MSITE-640
>             Project: Maven 2.x and 3.x Site Plugin
>          Issue Type: Bug
>          Components: Maven 3
>    Affects Versions: 3.0
>         Environment: Windows 7
>            Reporter: Markus Tippmann
>         Attachments: stacktrace.txt
>
>
> We are using dependencyManagement with "import" scope like described here:
> http://maven.apache.org/guides/introduction/introduction-to-dependency-mechanism.html#Importing_Dependencies
> Problem occurs only at site generation, not at build time, where it works 
> perfectly. 
> The site plugin tries to find the imported artifacts, but searches only the 
> central repository and ignores the repositories in settings.xml 
> configuration. Mirror settings work, if "central" is mirrored, but 
> dependencies need to be resolved from two repositories, so one mirror does 
> not help here.
> I try to attach the relevant parts of the stacktrace. 

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

Reply via email to