From 8bbb3183b5e90e0cb79e79525b6db65dde218907 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 19 Sep 2025 09:56:34 +0200 Subject: [PATCH 1/4] Bump org.assertj:assertj-core from 3.27.4 to 3.27.5 (#382) Bumps [org.assertj:assertj-core](https://github.com/assertj/assertj) from 3.27.4 to 3.27.5. - [Release notes](https://github.com/assertj/assertj/releases) - [Commits](https://github.com/assertj/assertj/compare/assertj-build-3.27.4...assertj-build-3.27.5) --- updated-dependencies: - dependency-name: org.assertj:assertj-core dependency-version: 3.27.5 dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index dc401d70..c4b40f8a 100644 --- a/pom.xml +++ b/pom.xml @@ -217,7 +217,7 @@ under the License. org.assertj assertj-core - 3.27.4 + 3.27.5 test From 5990c9f149dee9c7cff8a7445259ac27803a5733 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 24 Sep 2025 10:21:41 +0200 Subject: [PATCH 2/4] Bump org.assertj:assertj-core from 3.27.5 to 3.27.6 (#383) Bumps [org.assertj:assertj-core](https://github.com/assertj/assertj) from 3.27.5 to 3.27.6. - [Release notes](https://github.com/assertj/assertj/releases) - [Commits](https://github.com/assertj/assertj/compare/assertj-build-3.27.5...assertj-build-3.27.6) --- updated-dependencies: - dependency-name: org.assertj:assertj-core dependency-version: 3.27.6 dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index c4b40f8a..1b64ce54 100644 --- a/pom.xml +++ b/pom.xml @@ -217,7 +217,7 @@ under the License. org.assertj assertj-core - 3.27.5 + 3.27.6 test From 8615880b00e069fcbbe8c0ee1b9134229633de4c Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 3 Oct 2025 07:04:26 +0000 Subject: [PATCH 3/4] Bump org.apache.maven.plugins:maven-dependency-plugin Bumps [org.apache.maven.plugins:maven-dependency-plugin](https://github.com/apache/maven-dependency-plugin) from 3.8.1 to 3.9.0. - [Release notes](https://github.com/apache/maven-dependency-plugin/releases) - [Commits](https://github.com/apache/maven-dependency-plugin/compare/maven-dependency-plugin-3.8.1...maven-dependency-plugin-3.9.0) --- updated-dependencies: - dependency-name: org.apache.maven.plugins:maven-dependency-plugin dependency-version: 3.9.0 dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 1b64ce54..33ee638f 100644 --- a/pom.xml +++ b/pom.xml @@ -390,7 +390,7 @@ under the License. org.apache.maven.plugins maven-dependency-plugin - 3.8.1 + 3.9.0 copy-maven-distribution From 49dc9ffc280ec7e09f7f88898565d2524401e596 Mon Sep 17 00:00:00 2001 From: Moritz Becker Date: Fri, 10 Oct 2025 07:50:44 +0200 Subject: [PATCH 4/4] Fixes #367 - Do not consider project level glob as additional input value (#372) --- .../checksum/MavenProjectInput.java | 2 +- .../maven/buildcache/its/Issue367Test.java | 78 +++++++++++++++++++ .../mbuildcache-367/.mvn/extensions.xml | 25 ++++++ .../.mvn/maven-build-cache-config.xml | 32 ++++++++ src/test/projects/mbuildcache-367/pom.xml | 33 ++++++++ .../custom-resources/input/test.properties | 1 + 6 files changed, 170 insertions(+), 1 deletion(-) create mode 100644 src/test/java/org/apache/maven/buildcache/its/Issue367Test.java create mode 100644 src/test/projects/mbuildcache-367/.mvn/extensions.xml create mode 100644 src/test/projects/mbuildcache-367/.mvn/maven-build-cache-config.xml create mode 100644 src/test/projects/mbuildcache-367/pom.xml create mode 100644 src/test/projects/mbuildcache-367/src/main/custom-resources/input/test.properties diff --git a/src/main/java/org/apache/maven/buildcache/checksum/MavenProjectInput.java b/src/main/java/org/apache/maven/buildcache/checksum/MavenProjectInput.java index 969d10f7..d305a129 100644 --- a/src/main/java/org/apache/maven/buildcache/checksum/MavenProjectInput.java +++ b/src/main/java/org/apache/maven/buildcache/checksum/MavenProjectInput.java @@ -370,7 +370,7 @@ private SortedSet getInputFiles() { Properties properties = project.getProperties(); for (String name : properties.stringPropertyNames()) { - if (name.startsWith(CACHE_INPUT_NAME)) { + if (name.startsWith(CACHE_INPUT_NAME) && !CACHE_INPUT_GLOB_NAME.equals(name)) { String path = properties.getProperty(name); startWalk(Paths.get(path), projectGlob, recursive, collectedFiles, visitedDirs); } diff --git a/src/test/java/org/apache/maven/buildcache/its/Issue367Test.java b/src/test/java/org/apache/maven/buildcache/its/Issue367Test.java new file mode 100644 index 00000000..4214401c --- /dev/null +++ b/src/test/java/org/apache/maven/buildcache/its/Issue367Test.java @@ -0,0 +1,78 @@ +/* + * 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.buildcache.its; + +import java.io.IOException; +import java.nio.file.Files; +import java.nio.file.Paths; +import java.util.List; + +import org.apache.commons.lang3.SystemUtils; +import org.apache.maven.buildcache.its.junit.IntegrationTest; +import org.apache.maven.it.VerificationException; +import org.apache.maven.it.Verifier; +import org.junit.jupiter.api.Test; + +import static java.util.Arrays.asList; +import static org.junit.jupiter.api.Assumptions.assumeFalse; + +@IntegrationTest("src/test/projects/mbuildcache-367") +class Issue367Test { + + private static final String PROJECT_NAME = "org.apache.maven.caching.test:mbuildcache-367"; + + @Test + void fileOutsideInputDirectoryMatchingProjectLevelGlobPatternShouldNotInvalidateCache(Verifier verifier) + throws VerificationException, IOException { + assumeFalse(SystemUtils.IS_OS_WINDOWS); + + verifier.setAutoclean(false); + + verifier.setLogFileName("../log-0.txt"); + verifier.executeGoals(asList("package")); + verifier.verifyErrorFreeLog(); + verifier.verifyTextInLog("Local build was not found"); + verifyTextNotInLog(verifier, "Found cached build"); + + verifier.setLogFileName("../log-1.txt"); + verifier.executeGoals(asList("package")); + verifier.verifyErrorFreeLog(); + verifier.verifyTextInLog("Found cached build"); + verifyTextNotInLog(verifier, "Local build was not found"); + + Files.copy( + Paths.get(verifier.getBasedir(), "src/main/custom-resources/input/test.properties"), + Paths.get(verifier.getBasedir(), "{*.properties}")); + + verifier.setLogFileName("../log-2.txt"); + verifier.executeGoals(asList("package")); + verifier.verifyErrorFreeLog(); + verifier.verifyTextInLog("Found cached build"); + verifyTextNotInLog(verifier, "Local build was not found"); + } + + private static void verifyTextNotInLog(Verifier verifier, String text) throws VerificationException { + List lines = verifier.loadFile(verifier.getBasedir(), verifier.getLogFileName(), false); + for (String line : lines) { + if (Verifier.stripAnsi(line).contains(text)) { + throw new VerificationException("Text found in log: " + text); + } + } + } +} diff --git a/src/test/projects/mbuildcache-367/.mvn/extensions.xml b/src/test/projects/mbuildcache-367/.mvn/extensions.xml new file mode 100644 index 00000000..8df78f8b --- /dev/null +++ b/src/test/projects/mbuildcache-367/.mvn/extensions.xml @@ -0,0 +1,25 @@ + + + + + org.apache.maven.extensions + maven-build-cache-extension + ${projectVersion} + + diff --git a/src/test/projects/mbuildcache-367/.mvn/maven-build-cache-config.xml b/src/test/projects/mbuildcache-367/.mvn/maven-build-cache-config.xml new file mode 100644 index 00000000..02c9adbe --- /dev/null +++ b/src/test/projects/mbuildcache-367/.mvn/maven-build-cache-config.xml @@ -0,0 +1,32 @@ + + + + + + + + {*.properties} + + src/main/custom-resources/input/ + + + + diff --git a/src/test/projects/mbuildcache-367/pom.xml b/src/test/projects/mbuildcache-367/pom.xml new file mode 100644 index 00000000..6397b4bf --- /dev/null +++ b/src/test/projects/mbuildcache-367/pom.xml @@ -0,0 +1,33 @@ + + + + 4.0.0 + org.apache.maven.caching.test + mbuildcache-367 + 0.0.1-SNAPSHOT + jar + + + 1.8 + 1.8 + + {*.properties} + + diff --git a/src/test/projects/mbuildcache-367/src/main/custom-resources/input/test.properties b/src/test/projects/mbuildcache-367/src/main/custom-resources/input/test.properties new file mode 100644 index 00000000..f70f10e4 --- /dev/null +++ b/src/test/projects/mbuildcache-367/src/main/custom-resources/input/test.properties @@ -0,0 +1 @@ +A