This is an automated email from the ASF dual-hosted git repository. gnodet pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/maven.git
The following commit(s) were added to refs/heads/master by this push: new 9bea6ec23b Post merge fix (the profile condition activation missed some reshuffle of project layout) (#1933) 9bea6ec23b is described below commit 9bea6ec23bbb4d76adb7a50e3634b8a66873a4a3 Author: Tamas Cservenak <ta...@cservenak.net> AuthorDate: Fri Nov 22 10:48:50 2024 +0100 Post merge fix (the profile condition activation missed some reshuffle of project layout) (#1933) --- impl/maven-impl/pom.xml | 5 +++++ .../maven/internal/impl/model/rootlocator/DefaultRootLocator.java | 2 +- .../internal/impl/model/profile/AbstractProfileActivatorTest.java | 8 ++++++++ .../maven/internal/impl/model/profile/ConditionParserTest.java | 6 ++++-- .../impl/model/profile/ConditionProfileActivatorTest.java | 4 ++-- .../internal/impl/model/profile/FileProfileActivatorTest.java | 6 +++--- .../impl/model/profile/JdkVersionProfileActivatorTest.java | 0 .../impl/model/profile/OperatingSystemProfileActivatorTest.java | 0 .../internal/impl/model/profile/PropertyProfileActivatorTest.java | 0 .../maven/internal/impl/model/profile/SimpleProblemCollector.java | 0 10 files changed, 23 insertions(+), 8 deletions(-) diff --git a/impl/maven-impl/pom.xml b/impl/maven-impl/pom.xml index 6f1ea9a4cc..b7a6d445c1 100644 --- a/impl/maven-impl/pom.xml +++ b/impl/maven-impl/pom.xml @@ -119,6 +119,11 @@ under the License. <artifactId>junit-jupiter-api</artifactId> <scope>test</scope> </dependency> + <dependency> + <groupId>org.slf4j</groupId> + <artifactId>slf4j-simple</artifactId> + <scope>test</scope> + </dependency> <dependency> <groupId>org.mockito</groupId> <artifactId>mockito-core</artifactId> diff --git a/impl/maven-impl/src/main/java/org/apache/maven/internal/impl/model/rootlocator/DefaultRootLocator.java b/impl/maven-impl/src/main/java/org/apache/maven/internal/impl/model/rootlocator/DefaultRootLocator.java index 83850082dd..e874bd199e 100644 --- a/impl/maven-impl/src/main/java/org/apache/maven/internal/impl/model/rootlocator/DefaultRootLocator.java +++ b/impl/maven-impl/src/main/java/org/apache/maven/internal/impl/model/rootlocator/DefaultRootLocator.java @@ -48,7 +48,7 @@ public class DefaultRootLocator implements RootLocator { @Override public Path findRoot(Path basedir) { - requireNonNull(basedir, "basedir is null"); + requireNonNull(basedir, getNoRootMessage()); Path rootDirectory = basedir; while (rootDirectory != null && !isRootDirectory(rootDirectory)) { rootDirectory = rootDirectory.getParent(); diff --git a/maven-api-impl/src/test/java/org/apache/maven/internal/impl/model/profile/AbstractProfileActivatorTest.java b/impl/maven-impl/src/test/java/org/apache/maven/internal/impl/model/profile/AbstractProfileActivatorTest.java similarity index 90% rename from maven-api-impl/src/test/java/org/apache/maven/internal/impl/model/profile/AbstractProfileActivatorTest.java rename to impl/maven-impl/src/test/java/org/apache/maven/internal/impl/model/profile/AbstractProfileActivatorTest.java index acfdfa606b..ea68bb8e05 100644 --- a/maven-api-impl/src/test/java/org/apache/maven/internal/impl/model/profile/AbstractProfileActivatorTest.java +++ b/impl/maven-impl/src/test/java/org/apache/maven/internal/impl/model/profile/AbstractProfileActivatorTest.java @@ -18,6 +18,7 @@ */ package org.apache.maven.internal.impl.model.profile; +import java.nio.file.Path; import java.util.Properties; import org.apache.maven.api.model.Model; @@ -25,6 +26,7 @@ import org.apache.maven.api.model.Profile; import org.apache.maven.api.services.model.ProfileActivationContext; import org.apache.maven.api.services.model.ProfileActivator; import org.apache.maven.internal.impl.model.DefaultProfileActivationContext; +import org.apache.maven.internal.impl.model.rootlocator.DefaultRootLocator; import org.junit.jupiter.api.AfterEach; import org.junit.jupiter.api.BeforeEach; @@ -35,6 +37,12 @@ import static org.junit.jupiter.api.Assertions.assertEquals; * */ public abstract class AbstractProfileActivatorTest<T extends ProfileActivator> { + static class FakeRootLocator extends DefaultRootLocator { + @Override + protected boolean isRootDirectory(Path dir) { + return true; + } + } protected T activator; diff --git a/maven-api-impl/src/test/java/org/apache/maven/internal/impl/model/profile/ConditionParserTest.java b/impl/maven-impl/src/test/java/org/apache/maven/internal/impl/model/profile/ConditionParserTest.java similarity index 98% rename from maven-api-impl/src/test/java/org/apache/maven/internal/impl/model/profile/ConditionParserTest.java rename to impl/maven-impl/src/test/java/org/apache/maven/internal/impl/model/profile/ConditionParserTest.java index b91460c630..b665c11485 100644 --- a/maven-api-impl/src/test/java/org/apache/maven/internal/impl/model/profile/ConditionParserTest.java +++ b/impl/maven-impl/src/test/java/org/apache/maven/internal/impl/model/profile/ConditionParserTest.java @@ -29,9 +29,9 @@ import org.apache.maven.internal.impl.DefaultVersionParser; import org.apache.maven.internal.impl.model.DefaultInterpolator; import org.apache.maven.internal.impl.model.DefaultPathTranslator; import org.apache.maven.internal.impl.model.DefaultProfileActivationContext; -import org.apache.maven.internal.impl.model.DefaultRootLocator; import org.apache.maven.internal.impl.model.ProfileActivationFilePathInterpolator; import org.apache.maven.internal.impl.model.profile.ConditionParser.ExpressionFunction; +import org.apache.maven.internal.impl.model.rootlocator.DefaultRootLocator; import org.eclipse.aether.util.version.GenericVersionScheme; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; @@ -53,7 +53,9 @@ class ConditionParserTest { DefaultVersionParser versionParser = new DefaultVersionParser(new DefaultModelVersionParser(new GenericVersionScheme())); ProfileActivationFilePathInterpolator interpolator = new ProfileActivationFilePathInterpolator( - new DefaultPathTranslator(), bd -> true, new DefaultInterpolator()); + new DefaultPathTranslator(), + new AbstractProfileActivatorTest.FakeRootLocator(), + new DefaultInterpolator()); DefaultRootLocator rootLocator = new DefaultRootLocator(); functions = ConditionProfileActivator.registerFunctions(context, versionParser, interpolator); diff --git a/maven-api-impl/src/test/java/org/apache/maven/internal/impl/model/profile/ConditionProfileActivatorTest.java b/impl/maven-impl/src/test/java/org/apache/maven/internal/impl/model/profile/ConditionProfileActivatorTest.java similarity index 99% rename from maven-api-impl/src/test/java/org/apache/maven/internal/impl/model/profile/ConditionProfileActivatorTest.java rename to impl/maven-impl/src/test/java/org/apache/maven/internal/impl/model/profile/ConditionProfileActivatorTest.java index c549480d48..7b1c48abed 100644 --- a/maven-api-impl/src/test/java/org/apache/maven/internal/impl/model/profile/ConditionProfileActivatorTest.java +++ b/impl/maven-impl/src/test/java/org/apache/maven/internal/impl/model/profile/ConditionProfileActivatorTest.java @@ -33,8 +33,8 @@ import org.apache.maven.internal.impl.DefaultVersionParser; import org.apache.maven.internal.impl.model.DefaultInterpolator; import org.apache.maven.internal.impl.model.DefaultPathTranslator; import org.apache.maven.internal.impl.model.DefaultProfileActivationContext; -import org.apache.maven.internal.impl.model.DefaultRootLocator; import org.apache.maven.internal.impl.model.ProfileActivationFilePathInterpolator; +import org.apache.maven.internal.impl.model.rootlocator.DefaultRootLocator; import org.eclipse.aether.util.version.GenericVersionScheme; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Disabled; @@ -57,7 +57,7 @@ public class ConditionProfileActivatorTest extends AbstractProfileActivatorTest< activator = new ConditionProfileActivator( new DefaultVersionParser(new DefaultModelVersionParser(new GenericVersionScheme())), new ProfileActivationFilePathInterpolator( - new DefaultPathTranslator(), bd -> true, new DefaultInterpolator()), + new DefaultPathTranslator(), new FakeRootLocator(), new DefaultInterpolator()), new DefaultRootLocator()); Path file = tempDir.resolve("file.txt"); diff --git a/maven-api-impl/src/test/java/org/apache/maven/internal/impl/model/profile/FileProfileActivatorTest.java b/impl/maven-impl/src/test/java/org/apache/maven/internal/impl/model/profile/FileProfileActivatorTest.java similarity index 96% rename from maven-api-impl/src/test/java/org/apache/maven/internal/impl/model/profile/FileProfileActivatorTest.java rename to impl/maven-impl/src/test/java/org/apache/maven/internal/impl/model/profile/FileProfileActivatorTest.java index b758607ed3..bde150d74e 100644 --- a/maven-api-impl/src/test/java/org/apache/maven/internal/impl/model/profile/FileProfileActivatorTest.java +++ b/impl/maven-impl/src/test/java/org/apache/maven/internal/impl/model/profile/FileProfileActivatorTest.java @@ -53,7 +53,7 @@ class FileProfileActivatorTest extends AbstractProfileActivatorTest<FileProfileA @Override void setUp() throws Exception { activator = new FileProfileActivator(new ProfileActivationFilePathInterpolator( - new DefaultPathTranslator(), bd -> true, new DefaultInterpolator())); + new DefaultPathTranslator(), new FakeRootLocator(), new DefaultInterpolator())); context.setModel(Model.newBuilder().pomFile(tempDir.resolve("pom.xml")).build()); @@ -67,8 +67,8 @@ class FileProfileActivatorTest extends AbstractProfileActivatorTest<FileProfileA void testRootDirectoryWithNull() { context.setModel(Model.newInstance()); - IllegalStateException e = assertThrows( - IllegalStateException.class, + NullPointerException e = assertThrows( + NullPointerException.class, () -> assertActivation(false, newExistsProfile("${project.rootDirectory}"), context)); assertEquals(RootLocator.UNABLE_TO_FIND_ROOT_PROJECT_MESSAGE, e.getMessage()); } diff --git a/maven-api-impl/src/test/java/org/apache/maven/internal/impl/model/profile/JdkVersionProfileActivatorTest.java b/impl/maven-impl/src/test/java/org/apache/maven/internal/impl/model/profile/JdkVersionProfileActivatorTest.java similarity index 100% rename from maven-api-impl/src/test/java/org/apache/maven/internal/impl/model/profile/JdkVersionProfileActivatorTest.java rename to impl/maven-impl/src/test/java/org/apache/maven/internal/impl/model/profile/JdkVersionProfileActivatorTest.java diff --git a/maven-api-impl/src/test/java/org/apache/maven/internal/impl/model/profile/OperatingSystemProfileActivatorTest.java b/impl/maven-impl/src/test/java/org/apache/maven/internal/impl/model/profile/OperatingSystemProfileActivatorTest.java similarity index 100% rename from maven-api-impl/src/test/java/org/apache/maven/internal/impl/model/profile/OperatingSystemProfileActivatorTest.java rename to impl/maven-impl/src/test/java/org/apache/maven/internal/impl/model/profile/OperatingSystemProfileActivatorTest.java diff --git a/maven-api-impl/src/test/java/org/apache/maven/internal/impl/model/profile/PropertyProfileActivatorTest.java b/impl/maven-impl/src/test/java/org/apache/maven/internal/impl/model/profile/PropertyProfileActivatorTest.java similarity index 100% rename from maven-api-impl/src/test/java/org/apache/maven/internal/impl/model/profile/PropertyProfileActivatorTest.java rename to impl/maven-impl/src/test/java/org/apache/maven/internal/impl/model/profile/PropertyProfileActivatorTest.java diff --git a/maven-api-impl/src/test/java/org/apache/maven/internal/impl/model/profile/SimpleProblemCollector.java b/impl/maven-impl/src/test/java/org/apache/maven/internal/impl/model/profile/SimpleProblemCollector.java similarity index 100% rename from maven-api-impl/src/test/java/org/apache/maven/internal/impl/model/profile/SimpleProblemCollector.java rename to impl/maven-impl/src/test/java/org/apache/maven/internal/impl/model/profile/SimpleProblemCollector.java