Thank you for the hint, Tamás. The problem I’m trying to solve is that I want a custom Authentication for a particular server. I do not want to re-implement HttpTransporter. Here are the important bits of what I’ve come up with. ---------------------------------- public class MyTransporterFactory implements TransporterFactory {
// copied from org.eclipse.aether.transport.http.HttpTransporterFactory private static Map<String, ChecksumExtractor> getManuallyCreatedExtractors() { HashMap<String, ChecksumExtractor> map = new HashMap<>(); map.put(Nexus2ChecksumExtractor.NAME, new Nexus2ChecksumExtractor()); map.put(XChecksumChecksumExtractor.NAME, new XChecksumChecksumExtractor()); return Collections.unmodifiableMap(map); } // I’m not happy with this... private final HttpTransporterFactory httpTransporterFactory = new HttpTransporterFactory(getManuallyCreatedExtractors()); @Override public Transporter newInstance(RepositorySystemSession session, RemoteRepository repository) throws NoTransporterException { if (requiresSpecialAuth(repository)) { repository = new RemoteRepository.Builder(repository) .setAuthentication(new MyAuthentication(repository)) .build(); } return httpTransporterFactory.newInstance(session, repository); } ---------------------------------- Then “MyAuthentication” does the right thing for the fill method. This approach is working for me, but I’d be interested to know if there is a better way. I do not want to re-implement HttpTransport! On 2024/06/03 20:25:48 Tamás Cservenák wrote: > Howdy, > > What are you trying to do? You may go better if you implement custom > (resolver) transport maybe? > > Thanks > T > > On Mon, Jun 3, 2024, 22:22 David Grieve > <da...@microsoft.com.inva<mailto:da...@microsoft.com.inva>lid> > wrote: > > > My questions are: Is this doable and, if so, how would one go about it? > > > > I’m trying to cobble together a plugin/extension that will either get an > > auth token for resolving an artifact before the artifact is resolved, or > > will get an auth token if the resolution returns a 401. > > The plugin route happens too late in the execution, but I’ve found that > > with an AbstractMavenLifecycleParticipant at least afterProjectsRead gets > > called before artifact resolution. However, I can’t seem to affect the > > server password in a way that allows artifact resolution to succeed. > > I’ve also tried overriding some default implementations, but I don’t see > > the extension getting invoked (I see that Maven is aware of the extension, > > but it doesn’t get used AFAICT). > > >