Was this plugin ever produced? I'd like to get my hands on some similar
code.
Also, in the example below, where can I get the plexusContainer and settings
references? I assume this is being coded from within a plugin, but I don't
see where those collaborators live.
Emmanuel Venisse wrote:
>
> You can get them with profileManager with something like this :
>
> DefaultProfileManager manager = new DefaultProfileManager(
> plexusContainer, settings );
> loadProjectExternalProfiles( manager, projectDir );
> Map profiles = manager.getProfilesById();
>
>
> private void loadProjectExternalProfiles( ProfileManager profileManager,
> File projectDir )
> throws ProfileActivationException
> {
> if ( projectDir != null )
> {
> try
> {
> ProfilesRoot root = profilesBuilder.buildProfiles( projectDir
> );
>
> if ( root != null )
> {
> List active = root.getActiveProfiles();
>
> if ( active != null && !active.isEmpty() )
> {
> profileManager.explicitlyActivate(
> root.getActiveProfiles() );
> }
>
> for ( Iterator it = root.getProfiles().iterator();
> it.hasNext(); )
> {
> org.apache.maven.profiles.Profile rawProfile =
> (org.apache.maven.profiles.Profile) it.next();
>
> Profile converted =
> ProfilesConversionUtils.convertFromProfileXmlProfile(
> rawProfile );
>
> profileManager.addProfile( converted );
> }
> }
> }
> catch ( IOException e )
> {
> throw new ProfileActivationException( "Cannot read
> profiles.xml resource from
> directory: " + projectDir,
> e );
> }
> catch ( XmlPullParserException e )
> {
> throw new ProfileActivationException(
> "Cannot parse profiles.xml resource from directory: " +
> projectDir, e );
> }
> }
> }
>
If you do it, it can be useful to add this feature to help plugin
Emmanuel
Rahul Thakur a écrit :
> Hi,
>
> I am coding a Mojo that can display all Profiles available to a project
> and corresponding status (active/inactive).
>
> I tried project.getModel().getProfiles() to obtain all profiles, but
> don't seem to be getting all profiles set up in an external profiles.xml.
>
> How can I get a handle to all the profiles (active + merged/inlined +
> inactive) available to a project. Any ideas, any one?
>
> TIA,
>
> Rahul
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
--
View this message in context:
http://www.nabble.com/Obtaining-all-profiles-on-a-project---active-merged-inactive-tf1411207s177.html#a9598256
Sent from the Maven - Users mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]