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

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

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

Profile.getId介绍

[英]Get the identifier of this build profile. This is used for command line activation, and identifies profiles to be merged.
[中]获取此生成配置文件的标识符。这用于命令行激活,并标识要合并的配置文件。

代码示例

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

private List<String> getProfileIds( List<Profile> profiles )
{
  List<String> ids = new ArrayList<>( profiles.size() );
  for ( Profile profile : profiles )
  {
    ids.add( profile.getId() );
  }
  return ids;
}

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

@Override
public MavenExecutionRequest addProfile( Profile profile )
{
  Objects.requireNonNull( profile, "profile cannot be null" );
  for ( Profile p : getProfiles() )
  {
    if ( p.getId() != null && p.getId().equals( profile.getId() ) )
    {
      return this;
    }
  }
  getProfiles().add( profile );
  return this;
}

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

/**
 * @see java.lang.Object#toString()
 */
public String toString()
{
  return "Profile {id: " + getId() + ", source: " + getSource() + "}";
}

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

private void injectProfileActivations( Model model, Map<String, Activation> activations )
{
  for ( Profile profile : model.getProfiles() )
  {
    Activation activation = profile.getActivation();
    if ( activation == null )
    {
      continue;
    }
    // restore activation
    profile.setActivation( activations.get( profile.getId() ) );
  }
}

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

private Map<String, Activation> getProfileActivations( Model model, boolean clone )
{
  Map<String, Activation> activations = new HashMap<>();
  for ( Profile profile : model.getProfiles() )
  {
    Activation activation = profile.getActivation();
    if ( activation == null )
    {
      continue;
    }
    if ( clone )
    {
      activation = activation.clone();
    }
    activations.put( profile.getId(), activation );
  }
  return activations;
}

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

public void addProfile( Profile profile )
{
  String profileId = profile.getId();
  Profile existing = profilesById.get( profileId );
  if ( existing != null )
  {
    logger.warn( "Overriding profile: \'" + profileId + "\' (source: " + existing.getSource()
      + ") with new instance from source: " + profile.getSource() );
  }
  profilesById.put( profile.getId(), profile );
  Activation activation = profile.getActivation();
  if ( activation != null && activation.isActiveByDefault() )
  {
    activateAsDefault( profileId );
  }
}

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

public void addProfile( Profile profile )
{
  String profileId = profile.getId();
  Profile existing = (Profile) profilesById.get( profileId );
  if ( existing != null )
  {
    container.getLogger().warn( "Overriding profile: \'" + profileId + "\' (source: " + existing.getSource() +
      ") with new instance from source: " + profile.getSource() );
  }
  profilesById.put( profile.getId(), profile );
  Activation activation = profile.getActivation();
  if ( activation != null && activation.isActiveByDefault() )
  {
    activateAsDefault( profileId );
  }
}

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

if ( !deactivatedIds.contains( profile.getId() ) )
  if ( activatedIds.contains( profile.getId() ) || isActive( profile, context, problems ) )

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

+ profile.getId() + "'" );

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

+ profile.getId() + "'" );

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

throw new ProfileActivationException( "Invalid JDK version in profile '" + profile.getId() + "': "
  + e.getMessage() );

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

throw new ProfileActivationException( "Invalid JDK version in profile '" + profile.getId() + "': "
  + e.getMessage() );

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

.setMessage( "The property name is required to activate the profile " + profile.getId() )
    .setLocation( property.getLocation( "" ) ) );
return false;

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

.setMessage( "Failed to determine Java version for profile " + profile.getId() )
    .setLocation( activation.getLocation( "jdk" ) ) );
return false;

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

if ( ( profile.getId() != null ) && !profile.getId().equals( "default" ) )
  serializer.startTag( NAMESPACE, "id" ).text( profile.getId() ).endTag( NAMESPACE, "id" );

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

private boolean isActive( Profile profile, ProfileActivationContext context, ModelProblemCollector problems )
{
  boolean isActive = false;
  for ( ProfileActivator activator : activators )
  {
    if ( activator.presentInConfig( profile, context, problems ) )
    {
      isActive = true;
    }
  }
  for ( ProfileActivator activator : activators )
  {
    try
    {
      if ( activator.presentInConfig( profile, context, problems ) )
      {
        isActive &=  activator.isActive( profile, context, problems );
      }
    }
    catch ( RuntimeException e )
    {
      problems.add( new ModelProblemCollectorRequest( Severity.ERROR, Version.BASE )
          .setMessage( "Failed to determine activation for profile " + profile.getId() )
          .setLocation( profile.getLocation( "" ) )
          .setException( e ) );
      return false;
    }
  }
  return isActive;
}

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

.setMessage( "Failed to interpolate file location " + path + " for profile " + profile.getId()
       + ": " + e.getMessage() )
.setLocation( file.getLocation( missing ? "missing" : "exists" ) )

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

public static Profile cloneProfile( Profile src )
{
  if ( src == null )
  {
    return null;
  }
  
  Profile result = new Profile();
  
  cloneModelBaseFields( src, result );
  
  result.setActivation( cloneActivation( src.getActivation() ) );
  
  BuildBase resultBuild = null;
  if ( src.getBuild() != null )
  {
    resultBuild = new BuildBase();
    cloneBuildBaseFields( src.getBuild(), resultBuild );
  }
  result.setBuild( resultBuild );
  
  result.setId( src.getId() );
  result.setSource( src.getSource() );
  
  return result;
}

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

String prefix = "profiles.profile[" + profile.getId() + "]";
if ( !profileIds.add( profile.getId() ) )
         "must be unique but found duplicate profile with id " + profile.getId(), profile );
validate30RawProfileActivation( problems, profile.getActivation(), profile.getId(),
                prefix + ".activation", request );

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

profile.setId( modelProfile.getId() );

相关文章