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

DefaultMavenProjectBuilder.buildStandaloneSuperProject() should include a ProfileManager that includes active profiles from settings.xml

    XMLWordPrintableJSON

Details

    Description

      I have a custom plugin that performs JMX operations using properties defined in a profile. I have defined an active profile in the settings.xml that specifies properties that the plugin uses and everything works fine when a POM is present. Now I would like the plugin to work from any directory and have added the plugin annotation "requiresProject=false" to it.

      If I run the plugin in a directory without a POM the profile properties from settings.xml are never loaded. After performing some debugging I have determined that the default super-pom's model that is used when no POM xml file is available does not contain the profile properties defined in settings.xml while if a POM.xml is available the settings.xml profiles are loaded into the POM.

      This all appears to boil down to the lack of a ProfileManager parameter to thebuildStandaloneSuperProject method defined in the MavenProjectBuilder interface. While DefaultMaven's invocation of the component has a globalProfileManager available (with the active settings profiles set) it cannot be passed into the MavenProjectBuilder component. Alternatively, If the DefaultMavenProjectBuilder had the Settings component injected into it could pass it into the constructor of the DefaultProfileManager instance it creates and then the DefaultProfileManager would load the active profiles into the POM.

      By enabling this fix it would make plugins useful for management tasks, for example starting or stoping an application server.

      Attachments

        1. patch.txt
          4 kB
          Aaron Anderson

        Issue Links

          Activity

            People

              jdcasey John Dennis Casey
              aaronanderson Aaron Anderson
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: