slawekjaranowski commented on code in PR #50:
URL: 
https://github.com/apache/maven-plugin-testing/pull/50#discussion_r2429817831


##########
maven-plugin-testing-harness/src/main/java/org/apache/maven/api/plugin/testing/MojoExtension.java:
##########
@@ -131,10 +131,12 @@ public void beforeEach(ExtensionContext context) throws 
Exception {
         // TODO provide protected setters in PlexusExtension
         Field field = PlexusExtension.class.getDeclaredField("basedir");
         field.setAccessible(true);
-        field.set(null, getBasedir());
-        field = PlexusExtension.class.getDeclaredField("context");
-        field.setAccessible(true);
-        field.set(this, context);
+        String basedir = 
AnnotationSupport.findAnnotation(context.getElement().get(), Basedir.class)
+                .map(Basedir::value)
+                .orElse(getBasedir());
+        field.set(null, basedir);

Review Comment:
   this will be fixed with:
    - https://github.com/codehaus-plexus/plexus-testing/pull/92
    
   we should not override a static field



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to