[
https://issues.apache.org/jira/browse/MRESOLVER-157?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17277254#comment-17277254
]
Michael Osipov commented on MRESOLVER-157:
------------------------------------------
I tried Ant Resolver Tasks and it fails to compile because of
{code:java}
private AntRepoSys( Project project )
{
this.project = project;
locator = MavenRepositorySystemUtils.newServiceLocator();
locator.setErrorHandler( new AntServiceLocatorErrorHandler( project ) );
locator.setServices( Logger.class, new AntLogger( project ) );
locator.setServices( ModelBuilder.class, MODEL_BUILDER );
locator.addService( RepositoryConnectorFactory.class,
BasicRepositoryConnectorFactory.class );
locator.addService( TransporterFactory.class,
FileTransporterFactory.class );
locator.addService( TransporterFactory.class,
HttpTransporterFactory.class );
locator.addService( TransporterFactory.class,
ClasspathTransporterFactory.class );
}
...
public synchronized RepositorySystem getSystem()
{
if ( repoSys == null )
{
repoSys = locator.getService( RepositorySystem.class );
if ( repoSys == null )
{
throw new BuildException( "The repository system could not be
initialized" );
}
}
return repoSys;
}
...
private synchronized RemoteRepositoryManager getRemoteRepoMan()
{
if ( remoteRepoMan == null )
{
remoteRepoMan = locator.getService( RemoteRepositoryManager.class );
if ( remoteRepoMan == null )
{
throw new BuildException( "The repository system could not be
initialized" );
}
}
return remoteRepoMan;
}
{code}
> Get rid of ServiceLocator in Resolver
> -------------------------------------
>
> Key: MRESOLVER-157
> URL: https://issues.apache.org/jira/browse/MRESOLVER-157
> Project: Maven Resolver
> Issue Type: Task
> Components: Resolver
> Reporter: Tamás Cservenák
> Priority: Major
>
> maven-resolver currently supports:
> * ServiceLocator
> * "vanilla" Guice (provides a module)
> * DI using SISU, as used in Maven
> IMO, it makes not much sense to support 3 vastly different "DI"s (in quotes
> as ServiceLocator is really just a dumb factory pattern).
> Not only just complicates the code base, makes changes error prone at least,
> yields for "exceptions" (this or that will never work with it, as seen with
> SyncContext), and, for me most importantly, prevents proper constructor
> initialization and validation of components.
--
This message was sent by Atlassian Jira
(v8.3.4#803005)