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

x33g5p2x  于2022-01-26 转载在 其他  
字(9.0k)|赞(0)|评价(0)|浏览(103)

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

Profile.getProperties介绍

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

代码示例

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

/**
 * Method addProperty.
 * 
 * @param key
 * @param value
 */
public void addProperty( String key, String value )
{
  getProperties().put( key, value );
} //-- void addProperty( String, String )

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

if ( ( profile.getProperties() != null ) && ( profile.getProperties().size() > 0 ) )
  for ( Iterator iter = profile.getProperties().keySet().iterator(); iter.hasNext(); )
    String value = (String) profile.getProperties().get( key );
    serializer.startTag( NAMESPACE, "" + key + "" ).text( value ).endTag( NAMESPACE, "" + key + "" );

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

/**
 * Method addProperty.
 * 
 * @param key
 * @param value
 */
public void addProperty( String key, String value )
{
  getProperties().put( key, value );
} //-- void addProperty( String, String )

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

profile.setProperties( settingsProfile.getProperties() );

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

if ( ( profile.getProperties() != null ) && ( profile.getProperties().size() > 0 ) )
  for ( Iterator iter = profile.getProperties().keySet().iterator(); iter.hasNext(); )
    String value = (String) profile.getProperties().get( key );
    serializer.startTag( NAMESPACE, "" + key + "" ).text( value ).endTag( NAMESPACE, "" + key + "" );

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

public org.apache.maven.settings.Profile getFullSampleProfile(String id, Properties profileProperties) {
  org.apache.maven.settings.Profile profile = new org.apache.maven.settings.Profile();
  profile.setId(id);
  for (GlobalParameter globalParameter : globalParameters) {
    if (!globalParameter.valueGuessedByDefault) {
      String value;
      if (profileProperties.containsKey(globalParameter.property)) {
        value = profileProperties.getProperty(globalParameter.property);
      } else {
        value = "[...]";
      }
      profile.getProperties().put(globalParameter.property, value);
    }
  }
  return profile;
}

代码示例来源: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: io.teecube.t3/t3-common

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

代码示例来源:origin: org.eclipse.tycho/tycho-core

private Properties getGlobalProperties(MavenSession session) {
    Properties globalProps = new Properties();
    // 1. system
    globalProps.putAll(session.getSystemProperties());
    Settings settings = session.getSettings();
    // 2. active profiles
    Map<String, Profile> profileMap = settings.getProfilesAsMap();
    for (String profileId : settings.getActiveProfiles()) {
      Profile profile = profileMap.get(profileId);
      if (profile != null) {
        globalProps.putAll(profile.getProperties());
      }
    }
    // 3. user
    globalProps.putAll(session.getUserProperties());
    return globalProps;
  }
}

代码示例来源:origin: com.itemis.maven.plugins/unleash-maven-plugin

continue;
for (Map.Entry<Object, Object> entry : profile.getProperties().entrySet()) {
 this.properties.put((String) entry.getKey(), (String) entry.getValue());

代码示例来源:origin: shillner/unleash-maven-plugin

continue;
for (Map.Entry<Object, Object> entry : profile.getProperties().entrySet()) {
 this.properties.put((String) entry.getKey(), (String) entry.getValue());

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

private static void addActiveProfileRepositories(List<Profile> activeProfiles,
    List<RepositoryConfiguration> configurations) {
  for (Profile activeProfile : activeProfiles) {
    Interpolator interpolator = new RegexBasedInterpolator();
    interpolator.addValueSource(
        new PropertiesBasedValueSource(activeProfile.getProperties()));
    for (Repository repository : activeProfile.getRepositories()) {
      configurations.add(getRepositoryConfiguration(interpolator, repository));
    }
  }
}

代码示例来源:origin: opoo/opoopress

private String getPropertyValue(String propertyName) throws MojoFailureException {
  Map<String, Profile> profiles = settings.getProfilesAsMap();
  List<String> activeProfiles = settings.getActiveProfiles();
  for(String id: activeProfiles){
    Profile profile = profiles.get(id);
    if(profile != null){
      Properties properties = profile.getProperties();
      if(properties != null){
        String property = properties.getProperty(propertyName);
        if(property != null){
          getLog().info("Resolve deploy repository url: " + propertyName + " => " + property);
          return property;
        }
      }
    }
  }
  for(Profile profile: settings.getProfiles()){
    if(profile.getActivation() != null && profile.getActivation().isActiveByDefault()){
      Properties properties = profile.getProperties();
      if(properties != null){
        String property = properties.getProperty(propertyName);
        if(property != null){
          getLog().info("Resolve deploy repository url: " + propertyName + " => " + property);
          return property;
        }
      }
    }
  }
  throw new MojoFailureException("Can not resolve deploy repository url: " + propertyName);
}

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

public ProfileAdapter(final org.apache.maven.settings.Profile profile)
{
 setId(profile.getId());
 Activation activation = new Activation();
 setActivation(activation);
 for (org.apache.maven.settings.Repository repository : profile.getRepositories())
 {
   Repository mavenRepository = new Repository();
   mavenRepository.setId(repository.getId());
   mavenRepository.setUrl(repository.getUrl());
   getRepositories().add(mavenRepository);
 }
 setProperties(profile.getProperties());
}

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

public static Profile asProfile(org.apache.maven.settings.Profile profile) {
  Profile mavenProfile = new Profile();
  if (profile != null) {
    mavenProfile.setId(profile.getId());
    mavenProfile.setActivation(asActivation(profile.getActivation()));
    mavenProfile.setProperties(profile.getProperties());
    mavenProfile.setRepositories(asRepositories(profile.getRepositories()));
    mavenProfile.setPluginRepositories(asRepositories(profile.getPluginRepositories()));
  }
  return mavenProfile;
}

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

public static Profile asProfile(org.apache.maven.settings.Profile profile) {
  Profile mavenProfile = new Profile();
  if (profile != null) {
    mavenProfile.setId(profile.getId());
    mavenProfile.setActivation(asActivation(profile.getActivation()));
    mavenProfile.setProperties(profile.getProperties());
    mavenProfile.setRepositories(asRepositories(profile.getRepositories()));
    mavenProfile.setPluginRepositories(asRepositories(profile.getPluginRepositories()));
  }
  return mavenProfile;
}

代码示例来源:origin: org.netbeans.api/org-netbeans-modules-maven-embedder

/**
 * Method updateProfile.
 * 
 * @param value
 * @param element
 * @param counter
 * @param xmlTag
 */
protected void updateProfile(Profile value, String xmlTag, Counter counter, Element element)
{
  Element root = element;
  Counter innerCount = new Counter(counter.getDepth() + 1);
  updateActivation( value.getActivation(), "activation", innerCount, root);
  findAndReplaceProperties(innerCount, root,  "properties", value.getProperties());
  iterateRepository(innerCount, root, value.getRepositories(),"repositories","repository");
  iterateRepository(innerCount, root, value.getPluginRepositories(),"pluginRepositories","pluginRepository");
  findAndReplaceSimpleElement(innerCount, root,  "id", value.getId(), null);
} //-- void updateProfile(Profile, String, Counter, Element)

代码示例来源:origin: org.codehaus.mevenide/nb-mvn-embedder

/**
 * Method updateProfile
 * 
 * @param value
 * @param element
 * @param counter
 * @param xmlTag
 */
protected void updateProfile(Profile value, String xmlTag, Counter counter, Element element)
{
  Element root = element;
  Counter innerCount = new Counter(counter.getDepth() + 1);
  updateActivation( value.getActivation(), "activation", innerCount, root);
  findAndReplaceProperties(innerCount, root,  "properties", value.getProperties());
  iterateRepository(innerCount, root, value.getRepositories(),"repositories","repository");
  iterateRepository(innerCount, root, value.getPluginRepositories(),"pluginRepositories","pluginRepository");
  findAndReplaceSimpleElement(innerCount, root,  "id", value.getId(), null);
} //-- void updateProfile(Profile, String, Counter, Element)

相关文章