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]






---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to