gnodet-bot commented on code in PR #13166:
URL: https://github.com/apache/maven/pull/13166#discussion_r4041898132


##########
.github/workflows/update-lifecycle-plugins.yml:
##########
@@ -0,0 +1,94 @@
+# 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.
+
+name: Update lifecycle plugin versions
+
+on:
+  schedule:
+    # Every Monday at 08:00 UTC
+    - cron: '0 8 * * 1'
+  workflow_dispatch:
+
+permissions:
+  contents: read
+
+jobs:
+  update-lifecycle-plugins:
+    runs-on: ubuntu-latest
+    permissions:
+      contents: write
+      pull-requests: write
+    strategy:
+      fail-fast: false
+      matrix:
+        branch: [master, maven-4.0.x]
+    steps:
+      - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # 
v7.0.1
+        with:
+          ref: ${{ matrix.branch }}
+          persist-credentials: false
+
+      - uses: actions/setup-java@de7274f081f381c8f8158605e0321c36c376e2e6 # 
v6.0.1
+        with:
+          java-version: '21'
+          distribution: 'temurin'
+          cache: maven
+
+      - name: Update lifecycle plugin versions
+        run: |
+          mvn -B eu.maveniverse.maven.plugins:toolbox:0.16.0:plugin-versions \
+            -f impl/maven-core \
+            -Pversions-update \

Review Comment:
   ⚠️ **`-Pversions-update` still hard-fails on the `maven-4.0.x` matrix leg.**
   
   Moving the profile from root `pom.xml` to `impl/maven-core/pom.xml` fixes 
the `master` leg — when the workflow checks out `master`, 
`impl/maven-core/pom.xml` now contains the `versions-update` profile. ✅
   
   But when the matrix checks out `maven-4.0.x`, it reads `maven-4.0.x`'s 
`impl/maven-core/pom.xml`, which still has no `versions-update` profile. Maven 
4 still throws `MissingProfilesException` (via 
`DefaultMaven.validateRequiredProfiles()`) and the `maven-4.0.x` leg will 
always fail before toolbox runs.
   
   Fix options — pick one:
   1. **Make it optional**: `-P?versions-update` — Maven silently skips absent 
optional profiles.
   2. **Backport the profile to `maven-4.0.x`** (requires a separate PR on that 
branch).
   3. **Drop `-Pversions-update` entirely** — @cstamas already demonstrated 
toolbox works without it (`mvn toolbox:plugin-versions -f impl/maven-core/ 
-Dapply`), reading pluginManagement directly from the project POM.
   
   ```suggestion
               -Pversions-update \
   ```
   → change to `-P?versions-update \` to unblock immediately.



##########
.github/workflows/update-lifecycle-plugins.yml:
##########
@@ -0,0 +1,94 @@
+# 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.
+
+name: Update lifecycle plugin versions
+
+on:
+  schedule:
+    # Every Monday at 08:00 UTC
+    - cron: '0 8 * * 1'
+  workflow_dispatch:
+
+permissions:
+  contents: read
+
+jobs:
+  update-lifecycle-plugins:
+    runs-on: ubuntu-latest
+    permissions:
+      contents: write
+      pull-requests: write
+    strategy:
+      fail-fast: false
+      matrix:
+        branch: [master, maven-4.0.x]
+    steps:
+      - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # 
v7.0.1
+        with:
+          ref: ${{ matrix.branch }}
+          persist-credentials: false
+
+      - uses: actions/setup-java@de7274f081f381c8f8158605e0321c36c376e2e6 # 
v6.0.1
+        with:
+          java-version: '21'
+          distribution: 'temurin'
+          cache: maven
+
+      - name: Update lifecycle plugin versions
+        run: |
+          mvn -B eu.maveniverse.maven.plugins:toolbox:0.16.0:plugin-versions \
+            -f impl/maven-core \
+            -Pversions-update \
+            -DartifactVersionMatcherSpec="and(not(snapshot()), 
not(preview()))" \
+            -Dapply
+
+      - name: Create Pull Request
+        env:
+          GH_TOKEN: ${{ secrets.GH_TOKEN }}
+          BRANCH: update/lifecycle-plugins-${{ matrix.branch }}
+          BASE_BRANCH: ${{ matrix.branch }}
+        run: |
+          if git diff --quiet impl/maven-core/pom.xml; then
+            echo "No lifecycle plugin version changes detected."
+            exit 0
+          fi
+
+          echo "--- Updated properties ---"
+          git diff impl/maven-core/pom.xml | grep '^[+-].*version\.maven' | 
grep -v '^---\|^+++'

Review Comment:
   🐛 **Grep pattern is now dead — will never match after property rename.**
   
   The properties were renamed from `version.maven-*-plugin` to 
`lifecycle.*-plugin`, but the pattern here still looks for `version\.maven`. 
Every weekly run will silently print `--- Updated properties ---` followed by 
nothing, even when real updates were applied. The diff preview is completely 
broken.
   
   ```suggestion
             git diff impl/maven-core/pom.xml | grep '^[+-].*lifecycle\.' | 
grep -v '^---\|^+++'
   ```



##########
impl/maven-core/src/main/resources/org/apache/maven/lifecycle/plugin-versions.properties:
##########
@@ -20,16 +20,16 @@
 # POM properties (version.maven-<name>-plugin), making them visible to

Review Comment:
   📝 **Stale comment — still references the old `version.maven-<name>-plugin` 
naming.**
   
   The properties in this file were renamed to `lifecycle.*-plugin`, but the 
comment on line 20 still says `POM properties (version.maven-<name>-plugin)`. 
Should be updated to match.
   
   ```suggestion
   # POM properties (lifecycle.<name>-plugin), making them visible to
   ```



-- 
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