Skip to content

Commit 6bb6284

Browse files
committed
Try to find the PathMatcherFactory at test integration time:
* Add a `@Provider` annotation on the `PathMatcherFactory` interface. * Declare the `PathMatcherFactor` implementation in `META-INF/services`. * Add hard-coded instances of this interface. None of the above seems to work.
1 parent ec4d524 commit 6bb6284

File tree

4 files changed

+8
-0
lines changed

4 files changed

+8
-0
lines changed

api/maven-api-core/src/main/java/org/apache/maven/api/services/PathMatcherFactory.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
import org.apache.maven.api.Service;
2626
import org.apache.maven.api.annotations.Experimental;
2727
import org.apache.maven.api.annotations.Nonnull;
28+
import org.apache.maven.api.annotations.Provider;
2829

2930
/**
3031
* Service for creating {@link PathMatcher} objects that can be used to filter files
@@ -46,6 +47,7 @@
4647
* @since 4.0.0
4748
* @see PathMatcher
4849
*/
50+
@Provider
4951
@Experimental
5052
public interface PathMatcherFactory extends Service {
5153

impl/maven-core/src/main/java/org/apache/maven/plugin/DefaultBuildPluginManager.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
import org.apache.maven.execution.MojoExecutionEvent;
3333
import org.apache.maven.execution.MojoExecutionListener;
3434
import org.apache.maven.execution.scope.internal.MojoExecutionScope;
35+
import org.apache.maven.impl.DefaultPathMatcherFactory;
3536
import org.apache.maven.internal.impl.DefaultLog;
3637
import org.apache.maven.internal.impl.DefaultMojoExecution;
3738
import org.apache.maven.internal.impl.InternalMavenSession;
@@ -126,6 +127,7 @@ public void executeMojo(MavenSession session, MojoExecution mojoExecution)
126127
InternalMavenSession sessionV4 = InternalMavenSession.from(session.getSession());
127128
scope.seed(Project.class, sessionV4.getProject(project));
128129
scope.seed(org.apache.maven.api.MojoExecution.class, new DefaultMojoExecution(sessionV4, mojoExecution));
130+
scope.seed(org.apache.maven.api.services.PathMatcherFactory.class, new DefaultPathMatcherFactory());
129131

130132
if (mojoDescriptor.isV4Api()) {
131133
org.apache.maven.api.plugin.Mojo mojoV4 = mavenPluginManager.getConfiguredMojo(

impl/maven-core/src/main/java/org/apache/maven/plugin/internal/DefaultMavenPluginManager.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@
6060
import org.apache.maven.execution.MavenSession;
6161
import org.apache.maven.execution.scope.internal.MojoExecutionScope;
6262
import org.apache.maven.execution.scope.internal.MojoExecutionScopeModule;
63+
import org.apache.maven.impl.DefaultPathMatcherFactory;
6364
import org.apache.maven.internal.impl.DefaultLog;
6465
import org.apache.maven.internal.impl.DefaultMojoExecution;
6566
import org.apache.maven.internal.impl.InternalMavenSession;
@@ -565,6 +566,8 @@ private <T> T loadV4Mojo(
565566
injector.bindInstance(Project.class, project);
566567
injector.bindInstance(org.apache.maven.api.MojoExecution.class, execution);
567568
injector.bindInstance(org.apache.maven.api.plugin.Log.class, log);
569+
injector.bindInstance(
570+
org.apache.maven.api.services.PathMatcherFactory.class, new DefaultPathMatcherFactory());
568571
mojo = mojoInterface.cast(injector.getInstance(
569572
Key.of(mojoDescriptor.getImplementationClass(), mojoDescriptor.getRoleHint())));
570573

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
org.apache.maven.impl.DefaultPathMatcherFactory

0 commit comments

Comments
 (0)