Uploaded image for project: 'Maven'
  1. Maven
  2. MNG-7183

Plugin declaration silently ignored if groupId uses property references

    XMLWordPrintableJSON

Details

    Description

      Declaring a plugin where its <groupId> value is/contains a property reference (${example}) is silently ignored and no error is thrown since Maven 3.6.2 (worked on 3.6.1).

      Actual behavior:

      • Plugin configuration silently ignored

      Expected behavior:

      • Work as in 3.6.1, or
      • Produce an error if such config is not allowed

      Workaround:

      • Use a static value for the <groupId> without property references

      Suspecting root cause:

      Attached you could find a self-contained example using the maven-clean-plugin (but also happens with third-party plugins).
      To ease the comparison, this has 2 profiles: one declares the value explicitly and the other (indirect) via a property reference.

      Execute it as: ./run.sh
      and you will get at the end:

      ./out/maven-3.8.1-profile-indirect.log:[INFO] --- maven-clean-plugin:2.5:clean (default-clean) @ maven-bug-example ---
      ./out/maven-3.8.1-profile-indirect.log:[DEBUG] (f) skip = false
      ./out/maven-3.8.1-profile-explicit.log:[INFO] --- maven-clean-plugin:3.1.0:clean (default-clean) @ maven-bug-example ---
      ./out/maven-3.8.1-profile-explicit.log:[DEBUG] (f) skip = true
      ./out/maven-3.6.3-profile-indirect.log:[INFO] --- maven-clean-plugin:2.5:clean (default-clean) @ maven-bug-example ---
      ./out/maven-3.6.3-profile-indirect.log:[DEBUG] (f) skip = false
      ./out/maven-3.6.3-profile-explicit.log:[INFO] --- maven-clean-plugin:3.1.0:clean (default-clean) @ maven-bug-example ---
      ./out/maven-3.6.3-profile-explicit.log:[DEBUG] (f) skip = true
      ./out/maven-3.6.2-profile-indirect.log:[INFO] --- maven-clean-plugin:2.5:clean (default-clean) @ maven-bug-example ---
      ./out/maven-3.6.2-profile-indirect.log:[DEBUG] (f) skip = false
      ./out/maven-3.6.2-profile-explicit.log:[INFO] --- maven-clean-plugin:3.1.0:clean (default-clean) @ maven-bug-example ---
      ./out/maven-3.6.2-profile-explicit.log:[DEBUG] (f) skip = true
      ./out/maven-3.6.1-profile-indirect.log:[INFO] --- maven-clean-plugin:3.1.0:clean (default-clean) @ maven-bug-example ---
      ./out/maven-3.6.1-profile-indirect.log:[DEBUG] (f) skip = true
      ./out/maven-3.6.1-profile-explicit.log:[INFO] --- maven-clean-plugin:3.1.0:clean (default-clean) @ maven-bug-example ---
      ./out/maven-3.6.1-profile-explicit.log:[DEBUG] (f) skip = true
      

      Here you could see that the plugin version (2.5) and skip (false) configuration isn't what was configured for indirect profile.

      Another example, defining a base config as <pluginManagement>, it is also ignoring the specific <configuration> on <plugin> usage.

      Execute it as: ./run.sh pom-pluginManagement.xml
      and you will get at the end:

      ./out/maven-3.8.1-profile-indirect.log:[INFO] --- maven-clean-plugin:3.1.0:clean (default-clean) @ maven-bug-example ---
      ./out/maven-3.8.1-profile-indirect.log:[DEBUG] (f) skip = false
      ./out/maven-3.8.1-profile-explicit.log:[INFO] --- maven-clean-plugin:3.1.0:clean (default-clean) @ maven-bug-example ---
      ./out/maven-3.8.1-profile-explicit.log:[DEBUG] (f) skip = true
      ./out/maven-3.6.3-profile-indirect.log:[INFO] --- maven-clean-plugin:3.1.0:clean (default-clean) @ maven-bug-example ---
      ./out/maven-3.6.3-profile-indirect.log:[DEBUG] (f) skip = false
      ./out/maven-3.6.3-profile-explicit.log:[INFO] --- maven-clean-plugin:3.1.0:clean (default-clean) @ maven-bug-example ---
      ./out/maven-3.6.3-profile-explicit.log:[DEBUG] (f) skip = true
      ./out/maven-3.6.2-profile-indirect.log:[INFO] --- maven-clean-plugin:3.1.0:clean (default-clean) @ maven-bug-example ---
      ./out/maven-3.6.2-profile-indirect.log:[DEBUG] (f) skip = false
      ./out/maven-3.6.2-profile-explicit.log:[INFO] --- maven-clean-plugin:3.1.0:clean (default-clean) @ maven-bug-example ---
      ./out/maven-3.6.2-profile-explicit.log:[DEBUG] (f) skip = true
      ./out/maven-3.6.1-profile-indirect.log:[INFO] --- maven-clean-plugin:3.1.0:clean (default-clean) @ maven-bug-example ---
      ./out/maven-3.6.1-profile-indirect.log:[DEBUG] (f) skip = true
      ./out/maven-3.6.1-profile-explicit.log:[INFO] --- maven-clean-plugin:3.1.0:clean (default-clean) @ maven-bug-example ---
      ./out/maven-3.6.1-profile-explicit.log:[DEBUG] (f) skip = true
      

       

      Attachments

        1. bug-example.zip
          3 kB
          Martin D'Aloia

        Activity

          People

            Unassigned Unassigned
            mdaloia Martin D'Aloia
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated: