[ https://issues.apache.org/jira/browse/MENFORCER-447?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17651671#comment-17651671 ]
Pavel Horal edited comment on MENFORCER-447 at 12/23/22 3:46 PM: ----------------------------------------------------------------- The rule {{requirePluginVersions}} is not able to pick up versions specified in the parent POM. The issue is demonstrated in my test repository [https://github.com/pavelhoral/enforcer-plugin-test] . I have tried to find the issue and so far got to this call that incorrectly returns empty optional - [PluginWrapper.java#L75|https://github.com/apache/maven-enforcer/blob/374d7d6a98fb9a33e5740936d612eadfce9cbb66/enforcer-rules/src/main/java/org/apache/maven/plugins/enforcer/utils/PluginWrapper.java#L75] (called from here [RequirePluginVersions.java#L881|https://github.com/apache/maven-enforcer/blob/374d7d6a98fb9a33e5740936d612eadfce9cbb66/enforcer-rules/src/main/java/org/apache/maven/plugins/enforcer/RequirePluginVersions.java#L881]). By the way the JavaDoc of that method is not correct as empty optional is not the same as null result. *Update:* Plugin model entity does not have {{locations}} property set. Without that enforcer is not able to tell where the plugin is defined. *Update 2:* The issue seems to be that {{MavenXpp3Reader#parsePlugin}} is not setting location. So the issue is probably in Maven Core / Maven Model, not in Enforcer - [https://github.com/apache/maven/blob/e73a0b00fde80c400a6d854ec0c2ba7436325eed/maven-toolchain-model/src/main/mdo/reader.vm#L683] *Update 3:* Created MNG-7648 was (Author: pavel.horal): The rule {{requirePluginVersions}} is not able to pick up versions specified in the parent POM. The issue is demonstrated in my test repository https://github.com/pavelhoral/enforcer-plugin-test . I have tried to find the issue and so far got to this call that incorrectly returns empty optional - [PluginWrapper.java#L75|https://github.com/apache/maven-enforcer/blob/374d7d6a98fb9a33e5740936d612eadfce9cbb66/enforcer-rules/src/main/java/org/apache/maven/plugins/enforcer/utils/PluginWrapper.java#L75] (called from here [RequirePluginVersions.java#L881|https://github.com/apache/maven-enforcer/blob/374d7d6a98fb9a33e5740936d612eadfce9cbb66/enforcer-rules/src/main/java/org/apache/maven/plugins/enforcer/RequirePluginVersions.java#L881]). By the way the JavaDoc of that method is not correct as empty optional is not the same as null result. *Update:* Plugin model entity does not have {{locations}} property set. Without that enforcer is not able to tell where the plugin is defined. *Update 2:* The issue seems to be that {{MavenXpp3Reader#parsePlugin}} is not setting location. So the issue is probably in Maven Core / Maven Model, not in Enforcer - https://github.com/apache/maven/blob/e73a0b00fde80c400a6d854ec0c2ba7436325eed/maven-toolchain-model/src/main/mdo/reader.vm#L683 > Verify working with Maven 4 > --------------------------- > > Key: MENFORCER-447 > URL: https://issues.apache.org/jira/browse/MENFORCER-447 > Project: Maven Enforcer Plugin > Issue Type: Task > Reporter: Slawomir Jaranowski > Assignee: Slawomir Jaranowski > Priority: Major > Fix For: 3.2.0 > > -- This message was sent by Atlassian Jira (v8.20.10#820010)