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

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

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

Profile.setId介绍

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

代码示例

代码示例来源: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.setId( interpolatedTrimmed( parser.nextText(), "id" ) );

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

profile.setId( interpolatedTrimmed( parser.nextText(), "id" ) );

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

private Profile getProfile() {
    if (model.getProfiles() != null) {
      for (Profile profile : model.getProfiles()) {
        if (profile.getId().equals(id)) {
          return profile;
        }
      }
    }

    Profile profile = new Profile();
    profile.setId(id);
    model.addProfile(profile);
    return profile;
  }
}

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

profile.setId( profileXmlProfile.getId() );

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

profile.setId( settingsProfile.getId() );

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

private BuildBase getBuild(final Model model, String profileId) {
 if (profileId == null) {
  if (model.getBuild() == null) {
   model.setBuild(new Build());
  }
  return model.getBuild();
 } else {
  for (Profile p : model.getProfiles()) {
   if (profileId.equals(p.getId())) {
    if (p.getBuild() == null) {
     p.setBuild(new Build());
    }
    return p.getBuild();
   }
  }
  Profile profile = new Profile();
  profile.setId(profileId);
  profile.setBuild(new Build());
  model.addProfile(profile);
  return profile.getBuild();
 }
}

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

profile.setId( getTrimmedValue( value ) );

代码示例来源:origin: stackoverflow.com

public Profile getUserProfile(String response){
  Profile profile = null;
  try {
    profile = new Profile();
    JSONObject jsonObject = new JSONObject(response);
      profile.setId(jsonObject.getInt(context.getString(R.string.profile_id)));
    profile.setLastName(jsonObject.getString(context.getString(R.string.profile_lastName)));
    profile.setName(jsonObject.getString(context.getString(R.string.profile_name)));
    profile.setEmail(jsonObject.getString(context.getString(R.string.profile_email)));

  } catch (JSONException | NullPointerException e) {
    e.printStackTrace();
    return null;
  }

  return profile;
}

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

public static Profile getProfile(Model model, String profileId) {
  if (model == null || profileId == null || profileId.isEmpty()) return null;
  for (Profile profile : model.getProfiles()) {
    if (profileId.equals(profile.getId())) {
      return profile;
    }
  }
  Profile result = new Profile();
  result.setId(profileId);
  model.addProfile(result);
  return result;
}

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

private Profile createProfile( String profileId )
{
  Profile p = new Profile();
  p.setId( profileId );
  return p;
}

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

publicProfile.setId(PROFILE_PUBLIC);
Activation act = new Activation();
ActivationProperty prop = new ActivationProperty();

代码示例来源:origin: org.switchyard/switchyard-forge-plugin

Profile buildOpenShiftProfile() throws Exception {
  Model pom = project.getFacet(MavenCoreFacet.class).getPOM();
  Profile profile = new Profile();
  profile.setId(OPEN_SHIFT_PROFILE);
  
  Build build = new Build();
  build.setFinalName(pom.getArtifactId());
  profile.setBuild(build);
  addScannerPlugin(pom, profile);
  Plugin jarPlugin = new Plugin();
  jarPlugin.setGroupId("org.apache.maven.plugins");
  jarPlugin.setArtifactId("maven-jar-plugin");
  jarPlugin.setVersion("2.3.1");
  String pluginConfig = 
      "<configuration>"
      + "<outputDirectory>deployments</outputDirectory>"
      + "</configuration>";
  Xpp3Dom dom = Xpp3DomBuilder.build(new ByteArrayInputStream(pluginConfig.getBytes()), "UTF-8");
  jarPlugin.setConfiguration(dom);
  build.addPlugin(jarPlugin);
  
  return profile;
}

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

/**
 * The repositories defined in the ant "pom" task need to be added manually to the profile manager. Otherwise they
 * won't be available when resolving the parent pom. MANTTASKS-87
 */
private void addAntRepositoriesToProfileManager()
{
  List<RemoteRepository> remoteRepositories = this.getRemoteRepositories();
  if ( remoteRepositories == null || remoteRepositories.isEmpty() )
  {
    return;
  }
  org.apache.maven.model.Profile repositoriesProfile = new org.apache.maven.model.Profile();
  repositoriesProfile.setId( "maven-ant-tasks-repo-profile" );
  for ( RemoteRepository antRepo : remoteRepositories )
  {
    Repository mavenRepo = new Repository();
    mavenRepo.setId( antRepo.getId() );
    mavenRepo.setUrl( antRepo.getUrl() );
    repositoriesProfile.addRepository( mavenRepo );
  }
  getProfileManager().addProfile( repositoriesProfile );
  getProfileManager().explicitlyActivate( repositoriesProfile.getId() );
}

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

相关文章