Proposal to fix support for mirrors - #399
Conversation
This change relies on reusing existing API that can return proper URL (as set by user by ANY means in Maven config) to resolve from. Moreover, if repo ID is made configurable as well, it could be used to pull (needs more code) reposes like ID "my-corpo-repo" from settings and use that instead.
|
Thank you for this, If this is better solution I am all for it.
Sorry, I’m not familiar with this and I’m unsure what the next steps are or what you mean with this. For what is worth, I built and tested this locally and it seems to fix my original bug report, so I'd be happy to have this as an starting solution
|
|
From ASF CI: Weird. |
|
|
||
| @ExtendWith(MockitoExtension.class) | ||
| class WrapperMojoTest { | ||
| private final RepositorySystem repositorySystem; |
There was a problem hiding this comment.
To fully utilize Mockito Extension, IIRC:
@org.mockito.Mockon non-finalRepositorySystemandmockRepositorySystemSession, no need to initialize them- no need to initialize
wrapperMojo WrapperMojoTest()should became@BeforeEach void setUp(), method name could be anyany(RepositorySystemSession.class)sould becomesame(mockRepositorySystemSession)
But this would fail userSuppliedRepoUrlGetsTrailingSlashTrimmed with:
org.mockito.exceptions.misusing.UnnecessaryStubbingException:
Unnecessary stubbings detected.
Clean & maintainable test code requires zero unnecessary code.
Following stubbings are unnecessary (click to navigate to relevant line of code):
1. -> at org.apache.maven.plugins.wrapper.WrapperMojoTest.setUp(WrapperMojoTest.java:45)
Please remove unnecessary stubbings or use 'lenient' strictness. More info: javadoc for UnnecessaryStubbingException class.
To fix this, @Mock(strictness = Mock.Strictness.LENIENT) RepositorySystem mockRepositorySystem
|
@cstamas Please assign appropriate label to PR according to the type of change. |
This change relies on reusing existing API that can return proper URL (as set by user by ANY means in Maven config) to resolve from. PR contains also some cleanup.
Fixes #396
Supersedes #397