org.apache.maven.settings.Settings.getActiveProfiles()方法的使用及代码示例

x33g5p2x  于2022-01-29 转载在 其他  
字(7.7k)|赞(0)|评价(0)|浏览(159)

本文整理了Java中org.apache.maven.settings.Settings.getActiveProfiles()方法的一些代码示例,展示了Settings.getActiveProfiles()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Settings.getActiveProfiles()方法的具体详情如下:
包路径:org.apache.maven.settings.Settings
类名称:Settings
方法名:getActiveProfiles

Settings.getActiveProfiles介绍

[英]Method getActiveProfiles.
[中]方法getActiveProfiles。

代码示例

代码示例来源:origin: apache/maven

/**
 * Method removeActiveProfile.
 * 
 * @param string
 */
public void removeActiveProfile( String string )
{
  getActiveProfiles().remove( string );
} //-- void removeActiveProfile( String )

代码示例来源:origin: apache/maven

/**
 * Method addActiveProfile.
 * 
 * @param string
 */
public void addActiveProfile( String string )
{
  getActiveProfiles().add( string );
} //-- void addActiveProfile( String )

代码示例来源:origin: org.apache.maven/maven-project

public void loadSettingsProfiles( Settings settings )
  {
    if ( settings == null )
    {
      return;
    }

    List settingsProfiles = settings.getProfiles();

    List settingsActiveProfileIds = settings.getActiveProfiles();

    explicitlyActivate( settingsActiveProfileIds );

    if ( settingsProfiles != null && !settingsProfiles.isEmpty() )
    {
      for ( Iterator it = settings.getProfiles().iterator(); it.hasNext(); )
      {
        org.apache.maven.settings.Profile rawProfile = (org.apache.maven.settings.Profile) it.next();

        Profile profile = SettingsUtils.convertFromSettingsProfile( rawProfile );

        addProfile( profile );
      }
    }
  }
}

代码示例来源:origin: apache/maven

List<String> dominantActiveProfiles = dominant.getActiveProfiles();
List<String> recessiveActiveProfiles = recessive.getActiveProfiles();

代码示例来源:origin: apache/maven

if ( ( settings.getActiveProfiles() != null ) && ( settings.getActiveProfiles().size() > 0 ) )
  for ( Iterator iter = settings.getActiveProfiles().iterator(); iter.hasNext(); )

代码示例来源:origin: org.apache.maven/maven-settings

/**
 * Method removeActiveProfile.
 * 
 * @param string
 */
public void removeActiveProfile( String string )
{
  getActiveProfiles().remove( string );
} //-- void removeActiveProfile( String )

代码示例来源:origin: org.apache.maven/maven-settings

/**
 * Method addActiveProfile.
 * 
 * @param string
 */
public void addActiveProfile( String string )
{
  getActiveProfiles().add( string );
} //-- void addActiveProfile( String )

代码示例来源:origin: apache/maven

request.setActiveProfiles( settings.getActiveProfiles() );
  if ( settings.getActiveProfiles().contains( rawProfile.getId() ) )

代码示例来源:origin: apache/maven

request.setActiveProfiles( settings.getActiveProfiles() );
  if ( settings.getActiveProfiles().contains( rawProfile.getId() ) )

代码示例来源:origin: apache/maven

/**
   * @param settings could be null
   * @return a new instance of settings or null if settings was null.
   */
  public static Settings copySettings( Settings settings )
  {
    if ( settings == null )
    {
      return null;
    }

    Settings clone = new Settings();
    clone.setActiveProfiles( settings.getActiveProfiles() );
    clone.setInteractiveMode( settings.isInteractiveMode() );
    clone.setLocalRepository( settings.getLocalRepository() );
    clone.setMirrors( settings.getMirrors() );
    clone.setModelEncoding( settings.getModelEncoding() );
    clone.setOffline( settings.isOffline() );
    clone.setPluginGroups( settings.getPluginGroups() );
    clone.setProfiles( settings.getProfiles() );
    clone.setProxies( settings.getProxies() );
    clone.setServers( settings.getServers() );
    clone.setSourceLevel( settings.getSourceLevel() );
    clone.setUsePluginRegistry( settings.isUsePluginRegistry() );

    return clone;
  }
}

代码示例来源:origin: org.apache.maven/maven-settings

if ( ( settings.getActiveProfiles() != null ) && ( settings.getActiveProfiles().size() > 0 ) )
  for ( Iterator iter = settings.getActiveProfiles().iterator(); iter.hasNext(); )

代码示例来源:origin: shrinkwrap/resolver

@Override
  public List<String> getActiveProfileIds() {
    return getSettings().getActiveProfiles();
  }
}, problems);

代码示例来源:origin: org.jboss.shrinkwrap.resolver/shrinkwrap-resolver-impl-maven

@Override
  public List<String> getActiveProfileIds() {
    return getSettings().getActiveProfiles();
  }
}, problems);

代码示例来源:origin: io.teecube.t3/t3-common

@SuppressWarnings("unchecked") // because of Maven poor typing
public String getPropertyValueInSettings(String propertyName, Settings settings) {
  if (settings == null) {
    return null;
  }
  List<String> activeProfiles = settings.getActiveProfiles();
  for (Object _profileWithId : settings.getProfilesAsMap().entrySet()) {
    Entry<String, Profile> profileWithId = (Entry<String, Profile>) _profileWithId;
    if (activeProfiles.contains(profileWithId.getKey())) {
      Profile profile = profileWithId.getValue();
      String value = profile.getProperties().getProperty(propertyName);
      if (value != null) {
        return value;
      }
    }
  }
  return null;
}

代码示例来源:origin: org.kie.soup/kie-soup-maven-integration

private boolean isProfileActive( Profile profile ) {
  return settings.getActiveProfiles().contains( profile.getId() ) ||
      ( profile.getActivation() != null && profile.getActivation().isActiveByDefault() );
}

代码示例来源:origin: org.uberfire/uberfire-maven-integration

private boolean isProfileActive( Profile profile ) {
  return settings.getActiveProfiles().contains( profile.getId() ) ||
      ( profile.getActivation() != null && profile.getActivation().isActiveByDefault() );
}

代码示例来源:origin: spring-projects/sts4

private List<Profile> getActiveProfiles() throws MavenException {
  Settings settings = getSettings();
  List<String> activeProfilesIds = settings.getActiveProfiles();
  ArrayList<Profile> activeProfiles = new ArrayList<Profile>();
  for (org.apache.maven.settings.Profile settingsProfile : settings.getProfiles()) {
    if ((settingsProfile.getActivation() != null && settingsProfile.getActivation().isActiveByDefault())
        || activeProfilesIds.contains(settingsProfile.getId())) {
      Profile profile = SettingsUtils.convertFromSettingsProfile(settingsProfile);
      activeProfiles.add(profile);
    }
  }
  return activeProfiles;
}

代码示例来源:origin: org.jboss.forge/maven-impl

public List<RemoteRepository> getEnabledRepositoriesFromProfile(Settings settings)
{
 List<RemoteRepository> settingsRepos = new ArrayList<RemoteRepository>();
 List<String> activeProfiles = settings.getActiveProfiles();
 Map<String, Profile> profiles = settings.getProfilesAsMap();
 for (String id : activeProfiles)
 {
   Profile profile = profiles.get(id);
   if (profile != null)
   {
    List<Repository> repositories = profile.getRepositories();
    for (Repository repository : repositories)
    {
      settingsRepos.add(new RemoteRepository(repository.getId(), repository.getLayout(), repository.getUrl()));
    }
   }
 }
 return settingsRepos;
}

代码示例来源:origin: org.springframework.boot/spring-boot-cli

private List<Profile> determineActiveProfiles(Settings settings) {
  SpringBootCliModelProblemCollector problemCollector = new SpringBootCliModelProblemCollector();
  List<org.apache.maven.model.Profile> activeModelProfiles = createProfileSelector()
      .getActiveProfiles(createModelProfiles(settings.getProfiles()),
          new SpringBootCliProfileActivationContext(
              settings.getActiveProfiles()),
          problemCollector);
  if (!problemCollector.getProblems().isEmpty()) {
    throw new IllegalStateException(createFailureMessage(problemCollector));
  }
  List<Profile> activeProfiles = new ArrayList<>();
  Map<String, Profile> profiles = settings.getProfilesAsMap();
  for (org.apache.maven.model.Profile modelProfile : activeModelProfiles) {
    activeProfiles.add(profiles.get(modelProfile.getId()));
  }
  return activeProfiles;
}

代码示例来源:origin: spring-cloud/spring-cloud-function

private List<Profile> determineActiveProfiles(Settings settings) {
  SpringBootCliModelProblemCollector problemCollector = new SpringBootCliModelProblemCollector();
  List<org.apache.maven.model.Profile> activeModelProfiles = createProfileSelector()
      .getActiveProfiles(createModelProfiles(settings.getProfiles()),
          new SpringBootCliProfileActivationContext(
              settings.getActiveProfiles()),
          problemCollector);
  if (!problemCollector.getProblems().isEmpty()) {
    throw new IllegalStateException(createFailureMessage(problemCollector));
  }
  List<Profile> activeProfiles = new ArrayList<Profile>();
  Map<String, Profile> profiles = settings.getProfilesAsMap();
  for (org.apache.maven.model.Profile modelProfile : activeModelProfiles) {
    activeProfiles.add(profiles.get(modelProfile.getId()));
  }
  return activeProfiles;
}

相关文章