Is this code
project.getPluginRepositories().add(myCustomRepository);
executed inside afterProjectsRead
method of a maven extension (class extending AbstractMavenLifecycleParticipant
) supposed to work? It executes fine (no errors nor warnings) but the repo does not seem to be taken into account by Maven and build fails with "Plugin .... or one of its dependencies could not be resolved"!
If this is not possible this way, are there any other ways to dynamically add a repo from maven extension?
Another way is to listen as an
EventSpy
then inject project level settings, within what we can define custom repos.For example,
in
${basedir}/.mvn/extensions.xml
in
${basedir}/.mvn/settings.xml