Hi,
at first: I'm sorry for the long absence, I just didn't came to
answer you since friday.
Benjamin Bentman wrote:
I'm
sorry, but I don't follow your description. For the code you
pasted, I don't see how your ProxySelector would ever get called
so I would be curious to see the call stack at that time you
observe the call. It's also not clear to me where the central
repository is supposed to enter the picture.
Here you go, the Variables view in Debug mode tells me:
remote = 'central (http://repo1.maven.org/maven2, releases)'
org.eclipse.equinox.launcher.Main at localhost:49664
...
...
...
Thread [Worker-6] (Suspended (entry into method getProxy in
MyProxySelector))
owns: ModelRepository (id=98)
MyProxySelector.getProxy(RemoteRepository) line: 22
DefaultRemoteRepositoryManager.aggregateRepositories(RepositorySystemSession,
List<RemoteRepository>, List<RemoteRepository>,
boolean) line: 190
DefaultDependencyCollector.collectDependencies(RepositorySystemSession,
CollectRequest) line: 202
DefaultRepositorySystem.resolveDependencies(RepositorySystemSession,
DependencyRequest) line: 333
ModelRepository.resolve(Artifact, IProgressMonitor) line:
224
ModelArchiveResolutionJob.run(IProgressMonitor) line:
94
Worker.run() line: 54
Daemon Thread [AsyncHttpClient-Reaper] (Running)
Daemon Thread [AsyncHttpClient-Reaper] (Running)
However, your code snipped worked fine, thank you very much for
that!
But to be honest, your solution confuses me a little bit:
// prepare repo
remoteRepository.setProxy(session.getProxySelector().getProxy(remoteRepository);
Why do I have to to extract the Proxy from the ProxySelector
separately, wouldn't it be more intuitive to use the ProxySelector
directly for RemoteRepository?
Setting a Proxy via a setProxy(...) method with the call target as a
parameter for the getProxy(...) method of ProxySelector feels
strange to me.
Another approach would be to let the RepositorySystem fetch the
Proxy directly from the RepositorySystemSession.
This way, all values needed for the connection/session would be
stored in the SystemSession instead of the RemoteRepository.
I don't think you'll need to set different proxies for different
RemoteRepositories, but using one common session object, do you?
Best regards
Patrick
|