MNG-5591 use 'reactor' hint for reactor WorkspaceReader

When maven is invoked from m2e, container.lookup(WorkspaceReader.class)
returns component with role-hint=ide, which I believe is a bug in Susi
or Guice (or at least well misunderstood feature). This masks
ReactorReader workspace reader implementation and breaks reactor
dependency resolution.

The solution is to use explicit "reactor" role hint for ReactorReader.
This avoids fuzzy default component lookup logic and guarantees reactor
reader is always used regardless of presence of other workspace readers.

Signed-off-by: Igor Fedorenko <ifedorenko@apache.org>
This commit is contained in:
Igor Fedorenko 2014-02-28 23:54:45 -05:00
parent 48fec9440d
commit ac8e59ac60
2 changed files with 4 additions and 3 deletions

View File

@ -288,7 +288,7 @@ public class DefaultMaven
sessionScope.seed( MavenSession.class, session );
try
{
reactorWorkspace = container.lookup( WorkspaceReader.class );
reactorWorkspace = container.lookup( WorkspaceReader.class, ReactorReader.HINT );
}
catch ( ComponentLookupException e )
{

View File

@ -31,7 +31,6 @@ import java.util.Map;
import javax.inject.Inject;
import javax.inject.Named;
import javax.inject.Singleton;
import org.apache.maven.artifact.ArtifactUtils;
import org.apache.maven.execution.MavenSession;
@ -46,11 +45,13 @@ import org.eclipse.aether.util.artifact.ArtifactIdUtils;
*
* @author Jason van Zyl
*/
@Named
@Named( ReactorReader.HINT )
@SessionScoped
class ReactorReader
implements WorkspaceReader
{
public static final String HINT = "reactor";
private static final Collection<String> COMPILE_PHASE_TYPES = Arrays.asList( "jar", "ejb-client" );
private Map<String, MavenProject> projectsByGAV;