当前位置: 首页>>代码示例>>Java>>正文


Java Profile.getId方法代码示例

本文整理汇总了Java中org.apache.maven.model.Profile.getId方法的典型用法代码示例。如果您正苦于以下问题:Java Profile.getId方法的具体用法?Java Profile.getId怎么用?Java Profile.getId使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.maven.model.Profile的用法示例。


在下文中一共展示了Profile.getId方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: addProfile

import org.apache.maven.model.Profile; //导入方法依赖的package包/类
public void addProfile( Profile profile )
{
    String profileId = profile.getId();

    Profile existing = (Profile) 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 );
    }
}
 
开发者ID:gems-uff,项目名称:oceano,代码行数:21,代码来源:DefaultProfileManager.java

示例2: addProfile

import org.apache.maven.model.Profile; //导入方法依赖的package包/类
public MavenExecutionRequest addProfile( Profile profile )
{
    if ( profile == null )
    {
        throw new IllegalArgumentException( "profile missing" );
    }

    for ( Profile p : getProfiles() )
    {
        if ( p.getId() != null && p.getId().equals( profile.getId() ) )
        {
            return this;
        }
    }

    getProfiles().add( profile );

    return this;
}
 
开发者ID:gems-uff,项目名称:oceano,代码行数:20,代码来源:DefaultMavenExecutionRequest.java

示例3: provideActiveProfiles

import org.apache.maven.model.Profile; //导入方法依赖的package包/类
private void provideActiveProfiles(final Properties buildMetaDataProperties)
{
  final List<Profile> profiles = getActiveProfiles();
  if (profiles != null && !profiles.isEmpty())
  {
    final List<String> profileIds = new ArrayList<String>(profiles.size());
    for (final Profile profile : profiles)
    {
      final String profileId = profile.getId();
      if (!profileIds.contains(profileId))
      {
        final String key =
            Constant.MAVEN_ACTIVE_PROFILE_PREFIX + '.' + profileId;
        final String value = profile.getSource();
        buildMetaDataProperties.setProperty(key, value);
        profileIds.add(profileId);
      }
    }
    buildMetaDataProperties.setProperty(
        Constant.PROP_NAME_MAVEN_ACTIVE_PROFILES,
        MojoUtils.toPrettyString(profileIds));
  }
}
 
开发者ID:release-engineering,项目名称:buildmetadata-maven-plugin,代码行数:24,代码来源:MavenMetaDataProvider.java

示例4: collectProfilesIds

import org.apache.maven.model.Profile; //导入方法依赖的package包/类
private static Collection<String> collectProfilesIds(List<Profile> profiles) {
  Collection<String> result = new THashSet<String>();
  for (Profile each : profiles) {
    if (each.getId() != null) {
      result.add(each.getId());
    }
  }
  return result;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:10,代码来源:Maven30ServerEmbedderImpl.java

示例5: convertProfiles

import org.apache.maven.model.Profile; //导入方法依赖的package包/类
private static List<MavenProfile> convertProfiles(List<Profile> profiles, File projectDir) {
  List<MavenProfile> result = new ArrayList<>();

  if (profiles != null) {
    for (Profile profile : profiles) {
      if (profile.getId() == null) {
        continue;
      }

      MavenProfile mavenProfile = new MavenProfile(profile.getId(), profile.getSource());
      List<String> modules = profile.getModules();
      if (modules == null) {
        mavenProfile.setModules(Collections.emptyList());
      } else {
        mavenProfile.setModules(modules);
      }

      mavenProfile.setActivation(convertActivation(profile.getActivation()));
      if (profile.getBuild() != null) {
        convertBaseBuild(profile.getBuild(), mavenProfile.getBuild(), projectDir);
      }
      result.add(mavenProfile);
    }
  }

  return result;
}
 
开发者ID:eclipse,项目名称:che,代码行数:28,代码来源:MavenModelUtil.java

示例6: collectProfilesIds

import org.apache.maven.model.Profile; //导入方法依赖的package包/类
private static Collection<String> collectProfilesIds(List<Profile> profiles) {
  Collection<String> result = new HashSet<>();
  for (Profile each : profiles) {
    if (each.getId() != null) {
      result.add(each.getId());
    }
  }
  return result;
}
 
开发者ID:eclipse,项目名称:che,代码行数:10,代码来源:MavenServerImpl.java

示例7: isActive

import org.apache.maven.model.Profile; //导入方法依赖的package包/类
public boolean isActive( Profile profile )
    throws ProfileActivationException
{
    Activation activation = profile.getActivation();

    String jdk = activation.getJdk();

    // null case is covered by canDetermineActivation(), so we can do a straight startsWith() here.
    if ( jdk.startsWith( "[" ) || jdk.startsWith( "(" ) )
    {
        try
        {
            return matchJdkVersionRange( jdk );
        }
        catch ( InvalidVersionSpecificationException e )
        {
            throw new ProfileActivationException( "Invalid JDK version in profile '" + profile.getId() + "': "
                + e.getMessage() );
        }
    }

    boolean reverse = false;

    if ( jdk.startsWith( "!" ) )
    {
        reverse = true;
        jdk = jdk.substring( 1 );
    }

    if ( getJdkVersion().startsWith( jdk ) )
    {
        return !reverse;
    }
    else
    {
        return reverse;
    }
}
 
开发者ID:gems-uff,项目名称:oceano,代码行数:39,代码来源:JdkPrefixProfileActivator.java

示例8: beforeProjectLifecycleExecution

import org.apache.maven.model.Profile; //导入方法依赖的package包/类
@Override
public void beforeProjectLifecycleExecution(ProjectExecutionEvent event) throws LifecycleExecutionException {
    final MavenProject project = event.getProject();
    log.info("srcdeps enforcer checks for violations in {}:{}", project.getGroupId(), project.getArtifactId());

    final Maven maven = configurationProducer.getConfiguration().getMaven();

    final List<MojoExecution> mojoExecutions = event.getExecutionPlan();
    final List<String> goals = new ArrayList<>(mojoExecutions.size());
    for (MojoExecution mojoExecution : mojoExecutions) {
        MojoDescriptor mojoDescriptor = mojoExecution.getMojoDescriptor();
        goals.add(mojoDescriptor.getFullGoalName());
        goals.add(mojoDescriptor.getGoal());
    }

    final List<String> profiles = new ArrayList<>();
    final List<Profile> activeProfiles = project.getActiveProfiles();
    for (Profile profile : activeProfiles) {
        final String id = profile.getId();
        profiles.add(id);
    }

    final Properties props = new Properties();
    props.putAll(project.getProperties());
    props.putAll(System.getProperties());

    String[] firstViolation = assertFailWithout(maven.getFailWithout(), goals, profiles, props);
    if (firstViolation == null) {
        firstViolation = assertFailWith(maven.getFailWith(), goals, profiles, props);
    }
    if (firstViolation != null) {
        /* check if there are srcdeps */
        Artifact parent = project.getParentArtifact();
        if (parent != null) {
            assertNotSrcdeps(parent.getGroupId(), parent.getArtifactId(), parent.getVersion(), firstViolation);
        }
        DependencyManagement dm;
        List<Dependency> deps;
        if ((dm = project.getDependencyManagement()) != null && (deps = dm.getDependencies()) != null) {
            assertNotSrcdeps(deps, firstViolation);
        }
        if ((deps = project.getDependencies()) != null) {
            assertNotSrcdeps(deps, firstViolation);
        }
    }
}
 
开发者ID:srcdeps,项目名称:srcdeps-maven,代码行数:47,代码来源:SrcdepsEnforcer.java


注:本文中的org.apache.maven.model.Profile.getId方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。