[MNG-4900] "Unresolveable build extension" when using shade plugin and repositories in profile

git-svn-id: https://svn.apache.org/repos/asf/maven/maven-3/trunk@1036433 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Benjamin Bentmann 2010-11-18 12:25:06 +00:00
parent 2945612129
commit 8d53cd4cc6
1 changed files with 20 additions and 0 deletions

View File

@ -85,6 +85,26 @@ public class DefaultMavenProjectBuilder
request.setActiveProfileIds( profileManager.getExplicitlyActivatedIds() );
request.setInactiveProfileIds( profileManager.getExplicitlyDeactivatedIds() );
}
else
{
/*
* MNG-4900: Hack to workaround deficiency of legacy API which makes it impossible for plugins to access the
* global profile manager which is required to build a POM like a CLI invocation does. Failure to consider
* the activated profiles can cause repo declarations to be lost which in turn will result in artifact
* resolution failures, in particular when using the enhanced local repo which guards access to local files
* based on the configured remote repos.
*/
MavenSession session = legacySupport.getSession();
if ( session != null )
{
MavenExecutionRequest req = session.getRequest();
if ( req != null )
{
request.setActiveProfileIds( req.getActiveProfiles() );
request.setInactiveProfileIds( req.getInactiveProfiles() );
}
}
}
return request;
}