diff --git a/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng8254ExtensionWithDITest.java b/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng8254ExtensionWithDITest.java
new file mode 100644
index 000000000..e410b88b6
--- /dev/null
+++ b/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng8254ExtensionWithDITest.java
@@ -0,0 +1,55 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.maven.it;
+
+import java.io.File;
+
+import org.apache.maven.shared.verifier.Verifier;
+import org.apache.maven.shared.verifier.util.ResourceExtractor;
+import org.junit.jupiter.api.Test;
+
+/**
+ * This is a test set for MNG-8220.
+ */
+public class MavenITmng8254ExtensionWithDITest extends AbstractMavenIntegrationTestCase {
+ public MavenITmng8254ExtensionWithDITest() {
+ super("[4.0.0-beta-4,)");
+ }
+
+ /**
+ * Verify that the central url can be overridden by a user property.
+ *
+ * @throws Exception in case of failure
+ */
+ @Test
+ public void testitModel() throws Exception {
+ File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-8254-extension-with-di");
+
+ Verifier verifier = newVerifier(new File(testDir, "extension").getAbsolutePath());
+ verifier.addCliArgument("install");
+ verifier.execute();
+ verifier.verifyErrorFreeLog();
+
+ verifier = newVerifier(new File(testDir, "test").getAbsolutePath());
+ verifier.addCliArgument("-X");
+ verifier.addCliArgument("validate");
+ verifier.execute();
+ verifier.verifyTextInLog("[MNG-8254] DumbModelBuilder Called from extension");
+ }
+}
diff --git a/core-it-suite/src/test/java/org/apache/maven/it/TestSuiteOrdering.java b/core-it-suite/src/test/java/org/apache/maven/it/TestSuiteOrdering.java
index d2d64c663..3ac781648 100644
--- a/core-it-suite/src/test/java/org/apache/maven/it/TestSuiteOrdering.java
+++ b/core-it-suite/src/test/java/org/apache/maven/it/TestSuiteOrdering.java
@@ -120,6 +120,7 @@ public TestSuiteOrdering() {
* the tests are to finishing. Newer tests are also more likely to fail, so this is
* a fail fast technique as well.
*/
+ suite.addTestSuite(MavenITmng8254ExtensionWithDITest.class);
suite.addTestSuite(MavenITmng8220ExtensionWithDITest.class);
suite.addTestSuite(MavenITmng8181CentralRepoTest.class);
suite.addTestSuite(MavenITmng8123BuildCacheTest.class);
diff --git a/core-it-suite/src/test/resources/mng-8254-extension-with-di/extension/pom.xml b/core-it-suite/src/test/resources/mng-8254-extension-with-di/extension/pom.xml
new file mode 100644
index 000000000..6426be2dd
--- /dev/null
+++ b/core-it-suite/src/test/resources/mng-8254-extension-with-di/extension/pom.xml
@@ -0,0 +1,38 @@
+
+
+
+ org.apache.maven.its.mng8254
+ extension
+ 1.0-SNAPSHOT
+ jar
+
+
+
+ org.apache.maven
+ maven-api-di
+ 4.0.0-beta-4
+
+
+ org.apache.maven
+ maven-api-impl
+ 4.0.0-beta-4
+
+
+
diff --git a/core-it-suite/src/test/resources/mng-8254-extension-with-di/extension/src/main/java/org/apache/maven/its/mng8254/extension/DumbModelBuilder.java b/core-it-suite/src/test/resources/mng-8254-extension-with-di/extension/src/main/java/org/apache/maven/its/mng8254/extension/DumbModelBuilder.java
new file mode 100644
index 000000000..c3138c0cd
--- /dev/null
+++ b/core-it-suite/src/test/resources/mng-8254-extension-with-di/extension/src/main/java/org/apache/maven/its/mng8254/extension/DumbModelBuilder.java
@@ -0,0 +1,67 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.maven.its.mng8254.extension;
+
+import java.util.List;
+
+import org.apache.maven.api.di.Inject;
+import org.apache.maven.api.di.Named;
+import org.apache.maven.api.di.Priority;
+import org.apache.maven.api.di.Singleton;
+import org.apache.maven.api.model.Model;
+import org.apache.maven.api.services.ModelBuilder;
+import org.apache.maven.api.services.ModelBuilderException;
+import org.apache.maven.api.services.ModelBuilderRequest;
+import org.apache.maven.api.services.ModelBuilderResult;
+import org.apache.maven.api.services.ModelTransformerContextBuilder;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+@Singleton
+@Named
+@Priority(42)
+final class DumbModelBuilder implements ModelBuilder {
+
+ private final Logger logger = LoggerFactory.getLogger(getClass());
+ private final ModelBuilder delegate;
+
+ @Inject
+ public DumbModelBuilder(List delegate) {
+ this.delegate = delegate.stream()
+ .filter(modelBuilder -> !(modelBuilder instanceof DumbModelBuilder))
+ .findFirst()
+ .get();
+ }
+
+ @Override
+ public ModelBuilderResult build(ModelBuilderRequest request) throws ModelBuilderException {
+ logger.warn("[MNG-8254] DumbModelBuilder Called from extension");
+ return delegate.build(request);
+ }
+
+ @Override
+ public ModelTransformerContextBuilder newTransformerContextBuilder() {
+ return delegate.newTransformerContextBuilder();
+ }
+
+ @Override
+ public Model buildRawModel(ModelBuilderRequest request) {
+ return delegate.buildRawModel(request);
+ }
+}
diff --git a/core-it-suite/src/test/resources/mng-8254-extension-with-di/extension/src/main/resources/META-INF/maven/org.apache.maven.api.di.Inject b/core-it-suite/src/test/resources/mng-8254-extension-with-di/extension/src/main/resources/META-INF/maven/org.apache.maven.api.di.Inject
new file mode 100644
index 000000000..7232af8b8
--- /dev/null
+++ b/core-it-suite/src/test/resources/mng-8254-extension-with-di/extension/src/main/resources/META-INF/maven/org.apache.maven.api.di.Inject
@@ -0,0 +1 @@
+org.apache.maven.its.mng8254.extension.DumbModelBuilder
\ No newline at end of file
diff --git a/core-it-suite/src/test/resources/mng-8254-extension-with-di/test/.mvn/extensions.xml b/core-it-suite/src/test/resources/mng-8254-extension-with-di/test/.mvn/extensions.xml
new file mode 100644
index 000000000..3421d4c20
--- /dev/null
+++ b/core-it-suite/src/test/resources/mng-8254-extension-with-di/test/.mvn/extensions.xml
@@ -0,0 +1,7 @@
+
+
+ org.apache.maven.its.mng8254
+ extension
+ 1.0-SNAPSHOT
+
+
diff --git a/core-it-suite/src/test/resources/mng-8254-extension-with-di/test/pom.xml b/core-it-suite/src/test/resources/mng-8254-extension-with-di/test/pom.xml
new file mode 100644
index 000000000..31730098b
--- /dev/null
+++ b/core-it-suite/src/test/resources/mng-8254-extension-with-di/test/pom.xml
@@ -0,0 +1,25 @@
+
+
+
+ org.apache.maven.its.mng8254
+ test
+ 1.0-SNAPSHOT
+ jar
+
diff --git a/core-it-suite/src/test/resources/mng-8254-extension-with-di/test/src/main/java/org/apache/maven/its/mng8220/test/Dumb.java b/core-it-suite/src/test/resources/mng-8254-extension-with-di/test/src/main/java/org/apache/maven/its/mng8220/test/Dumb.java
new file mode 100644
index 000000000..584baf670
--- /dev/null
+++ b/core-it-suite/src/test/resources/mng-8254-extension-with-di/test/src/main/java/org/apache/maven/its/mng8220/test/Dumb.java
@@ -0,0 +1,21 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.maven.its.mng8220.test;
+
+public class Dumb {}