本文整理了Java中org.apache.maven.model.Model.addProfile()
方法的一些代码示例,展示了Model.addProfile()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Model.addProfile()
方法的具体详情如下:
包路径:org.apache.maven.model.Model
类名称:Model
方法名:addProfile
[英]Method addProfile.
[中]方法addProfile。
代码示例来源: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: ru.yandex.qatools.clay/clay-maven-settings-builder
/**
* Method addProfile.
*
* @param profile
*/
public FluentModelBuilder withProfile(Profile profile) {
model.addProfile(profile);
return this;
}
代码示例来源:origin: com.buschmais.jqassistant.plugin/jqassistant.plugin.m2repo
@Override
public void addProfile(Profile profile) {
delegate.addProfile(profile);
}
代码示例来源: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: 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: org.sonatype.maven.archetype/archetype-common
private void mergeProfiles(Model model, Model generatedModel) {
List<Profile> generatedProfiles=generatedModel.getProfiles();
if (generatedProfiles != null && generatedProfiles.size() > 0) {
List<Profile> modelProfiles=model.getProfiles();
Map<String,Profile> modelProfileIdMap=new HashMap<String,Profile>();
if (modelProfiles == null) {
modelProfiles=new ArrayList<Profile>();
model.setProfiles(modelProfiles);
}
else if (modelProfiles.size() > 0) {
// add profile ids from the model for later lookups to the modelProfileIds set
for (Profile modelProfile : modelProfiles) {
modelProfileIdMap.put(modelProfile.getId(), modelProfile);
}
}
for (Profile generatedProfile : generatedProfiles) {
String generatedProfileId=generatedProfile.getId();
if (!modelProfileIdMap.containsKey(generatedProfileId)) {
model.addProfile(generatedProfile);
}
else {
log.warn("Try to merge profiles with id " + generatedProfileId);
mergeModelBase(modelProfileIdMap.get(generatedProfileId), generatedProfile);
mergeProfileBuild(modelProfileIdMap.get(generatedProfileId), generatedProfile);
}
}
}
}
代码示例来源:origin: apache/maven-archetype
if ( !modelProfileIdMap.containsKey( generatedProfileId ) )
model.addProfile( generatedProfile );
代码示例来源:origin: org.codehaus.mevenide/nb-project
publicProfile.setActivation(act);
publicProfile.setBuild(new BuildBase());
model.addProfile(publicProfile);
markAsModified(model);
代码示例来源: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;
}
}
}
代码示例来源:origin: errai/errai
profile = new Profile();
profile.setId(name);
pom.addProfile(profile);
代码示例来源:origin: mojohaus/flatten-maven-plugin
strippedProfile.setDependencies( profile.getDependencies() );
strippedProfile.setRepositories( profile.getRepositories() );
cleanPom.addProfile( strippedProfile );
内容来源于网络,如有侵权,请联系作者删除!