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

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

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

Profile.setActivation介绍

[英]Set the conditional logic which will automatically trigger the inclusion of this profile.
[中]设置自动触发包含此配置文件的条件逻辑。

代码示例

代码示例来源: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: 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

profile.setActivation( parseActivation( parser, strict ) );

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

profile.setActivation( parseActivation( parser, strict, source ) );

代码示例来源:origin: takari/polyglot-maven

private Activation getActivation() {
  if (getProfile().getActivation() == null) {
    getProfile().setActivation(new Activation());
  }
  return getProfile().getActivation();
}

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

profile.setActivation( activation );

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

profile.setActivation( activation );

代码示例来源:origin: takari/polyglot-maven

profile.setActivation( parseActivation( parser, strict ) );

代码示例来源:origin: errai/errai

private void resetProfileActivations(final Model pom, final Map<String, Activation> profileActivationMap) {
 for (final Profile profile : pom.getProfiles()) {
  if (profileActivationMap.containsKey(profile.getId())) {
   profile.setActivation(profileActivationMap.get(profile.getId()));
  }
 }
}

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

/**
 * Creates a Profile object that contains the activation information.
 *
 * @return a properly populated profile to be used for OS validation.
 */
private Profile createProfile()
{
  Profile profile = new Profile();
  profile.setActivation( createActivation() );
  return profile;
}

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

/**
 * Creates a Profile object that contains the activation information.
 *
 * @return a properly populated profile to be used for OS validation.
 */
private Profile createProfile()
{
  Profile profile = new Profile();
  profile.setActivation( createActivation() );
  return profile;
}

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

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: spring-cloud/spring-cloud-function

private List<org.apache.maven.model.Profile> createModelProfiles(
    List<Profile> profiles) {
  List<org.apache.maven.model.Profile> modelProfiles = new ArrayList<org.apache.maven.model.Profile>();
  for (Profile profile : profiles) {
    org.apache.maven.model.Profile modelProfile = new org.apache.maven.model.Profile();
    modelProfile.setId(profile.getId());
    if (profile.getActivation() != null) {
      modelProfile
          .setActivation(createModelActivation(profile.getActivation()));
    }
    modelProfiles.add(modelProfile);
  }
  return modelProfiles;
}

代码示例来源:origin: errai/errai

/**
 * @return A map of the profile activations that were replaced.
 */
private Map<String, Activation> setBlacklistProfilesToInactive(final Model pom) {
 final Map<String, Activation> profileActivationMap = new HashMap<String, Activation>(pom.getProfiles().size());
 final Activation inactive = new Activation();
 inactive.setActiveByDefault(false);
 for (final Profile profile : pom.getProfiles()) {
  if (ArtifactVault.getBlacklistProfiles().contains(profile.getId())) {
   profileActivationMap.put(profile.getId(), profile.getActivation());
   profile.setActivation(inactive);
  }
 }
 
 return profileActivationMap;
}

代码示例来源:origin: org.springframework.boot.experimental/spring-boot-thin-launcher

private List<org.apache.maven.model.Profile> createModelProfiles(
    List<Profile> profiles) {
  List<org.apache.maven.model.Profile> modelProfiles = new ArrayList<org.apache.maven.model.Profile>();
  for (Profile profile : profiles) {
    org.apache.maven.model.Profile modelProfile = new org.apache.maven.model.Profile();
    modelProfile.setId(profile.getId());
    if (profile.getActivation() != null) {
      modelProfile
          .setActivation(createModelActivation(profile.getActivation()));
    }
    modelProfiles.add(modelProfile);
  }
  return modelProfiles;
}

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

private List<org.apache.maven.model.Profile> createModelProfiles(
    List<Profile> profiles) {
  List<org.apache.maven.model.Profile> modelProfiles = new ArrayList<>();
  for (Profile profile : profiles) {
    org.apache.maven.model.Profile modelProfile = new org.apache.maven.model.Profile();
    modelProfile.setId(profile.getId());
    if (profile.getActivation() != null) {
      modelProfile
          .setActivation(createModelActivation(profile.getActivation()));
    }
    modelProfiles.add(modelProfile);
  }
  return modelProfiles;
}

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

prop.setValue("true"); //NOI18N
act.setProperty(prop);
publicProfile.setActivation(act);
publicProfile.setBuild(new BuildBase());
model.addProfile(publicProfile);

代码示例来源: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: errai/errai

@Override
 public boolean install() {
  if (super.install()) {
   // Set main profile to be active by default
   final MavenFacet coreFacet = getProject().getFacet(MavenFacet.class);
   final Model pom = coreFacet.getModel();
   Profile profile = MavenModelUtil.getProfileById(MAIN_PROFILE, pom.getProfiles());
   if (profile == null) {
    profile = new Profile();
    profile.setId(MAIN_PROFILE);
    pom.addProfile(profile);
   }
   if (profile.getActivation() == null)
    profile.setActivation(new Activation());
   profile.getActivation().setActiveByDefault(true);
   coreFacet.setModel(pom);

   return true;
  }
  else {
   return false;
  }
 }
}

相关文章