本文整理汇总了Java中org.apache.maven.model.Activation.isActiveByDefault方法的典型用法代码示例。如果您正苦于以下问题:Java Activation.isActiveByDefault方法的具体用法?Java Activation.isActiveByDefault怎么用?Java Activation.isActiveByDefault使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.maven.model.Activation
的用法示例。
在下文中一共展示了Activation.isActiveByDefault方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: writeActivation
import org.apache.maven.model.Activation; //导入方法依赖的package包/类
private void writeActivation(Activation activation, String tagName, XmlSerializer serializer)
throws java.io.IOException {
serializer.startTag(NAMESPACE, tagName);
flush(serializer);
StringBuffer b = b(serializer);
int start = b.length();
if (activation.isActiveByDefault() != false) {
writeValue(serializer, "activeByDefault", String.valueOf(activation.isActiveByDefault()), activation);
}
if (activation.getJdk() != null) {
writeValue(serializer, "jdk", activation.getJdk(), activation);
}
if (activation.getOs() != null) {
writeActivationOS((ActivationOS) activation.getOs(), "os", serializer);
}
if (activation.getProperty() != null) {
writeActivationProperty((ActivationProperty) activation.getProperty(), "property", serializer);
}
if (activation.getFile() != null) {
writeActivationFile((ActivationFile) activation.getFile(), "file", serializer);
}
serializer.endTag(NAMESPACE, tagName).flush();
logLocation(activation, "", start, b.length());
}
示例2: addProfile
import org.apache.maven.model.Activation; //导入方法依赖的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 );
}
}
示例3: transformableWithDiscardActiveReference
import org.apache.maven.model.Activation; //导入方法依赖的package包/类
@SuppressWarnings({"unchecked"})
public void transformableWithDiscardActiveReference() throws IOException {
PomTransformer pomTransformer = new PomTransformer(transformablePomAsString,
PomCleanupPolicy.discard_active_reference);
String transformedPom = pomTransformer.transform();
Model pom = MavenModelUtils.stringToMavenModel(transformedPom);
List repositoriesList = pom.getRepositories();
List pluginsRepositoriesList = pom.getPluginRepositories();
assertEmptyList(repositoriesList, pluginsRepositoriesList);
List<Profile> pomProfiles = pom.getProfiles();
for (Profile profile : pomProfiles) {
boolean activeByDefault = false;
Activation activation = profile.getActivation();
if (activation != null) {
activeByDefault = activation.isActiveByDefault();
}
List profileRepositories = profile.getRepositories();
List profilePluginsRepositories = profile.getPluginRepositories();
if (activeByDefault) {
assertEmptyList(profileRepositories, profilePluginsRepositories);
} else {
assertNotEmptyList(profileRepositories, profilePluginsRepositories);
}
}
assertTrue(transformablePomAsString.contains("This is a comment"));
compareChecksums(transformablePomAsString, transformedPom, false);
}
示例4: applyProfiles
import org.apache.maven.model.Activation; //导入方法依赖的package包/类
public static ProfileApplicationResult applyProfiles(MavenModel model,
File basedir,
MavenExplicitProfiles explicitProfiles,
Collection<String> alwaysOnProfiles) throws RemoteException {
Model nativeModel = MavenModelConverter.toNativeModel(model);
Collection<String> enabledProfiles = explicitProfiles.getEnabledProfiles();
Collection<String> disabledProfiles = explicitProfiles.getDisabledProfiles();
List<Profile> activatedPom = new ArrayList<Profile>();
List<Profile> activatedExternal = new ArrayList<Profile>();
List<Profile> activeByDefault = new ArrayList<Profile>();
List<Profile> rawProfiles = nativeModel.getProfiles();
List<Profile> expandedProfilesCache = null;
List<Profile> deactivatedProfiles = new ArrayList<Profile>();
for (int i = 0; i < rawProfiles.size(); i++) {
Profile eachRawProfile = rawProfiles.get(i);
if (disabledProfiles.contains(eachRawProfile.getId())) {
deactivatedProfiles.add(eachRawProfile);
continue;
}
boolean shouldAdd = enabledProfiles.contains(eachRawProfile.getId()) || alwaysOnProfiles.contains(eachRawProfile.getId());
Activation activation = eachRawProfile.getActivation();
if (activation != null) {
if (activation.isActiveByDefault()) {
activeByDefault.add(eachRawProfile);
}
// expand only if necessary
if (expandedProfilesCache == null) expandedProfilesCache = doInterpolate(nativeModel, basedir).getProfiles();
Profile eachExpandedProfile = expandedProfilesCache.get(i);
for (ProfileActivator eachActivator : getProfileActivators(basedir)) {
try {
if (eachActivator.canDetermineActivation(eachExpandedProfile) && eachActivator.isActive(eachExpandedProfile)) {
shouldAdd = true;
break;
}
}
catch (ProfileActivationException e) {
Maven3ServerGlobals.getLogger().warn(e);
}
}
}
if (shouldAdd) {
if (MavenConstants.PROFILE_FROM_POM.equals(eachRawProfile.getSource())) {
activatedPom.add(eachRawProfile);
}
else {
activatedExternal.add(eachRawProfile);
}
}
}
List<Profile> activatedProfiles = new ArrayList<Profile>(activatedPom.isEmpty() ? activeByDefault : activatedPom);
activatedProfiles.addAll(activatedExternal);
for (Profile each : activatedProfiles) {
new DefaultProfileInjector().injectProfile(nativeModel, each, null, null);
}
return new ProfileApplicationResult(MavenModelConverter.convertModel(nativeModel, null),
new MavenExplicitProfiles(collectProfilesIds(activatedProfiles),
collectProfilesIds(deactivatedProfiles))
);
}
示例5: applyProfiles
import org.apache.maven.model.Activation; //导入方法依赖的package包/类
public static ProfileApplicationResult applyProfiles(MavenModel model,
File basedir,
MavenExplicitProfiles explicitProfiles,
Collection<String> alwaysOnProfiles) throws RemoteException {
Model nativeModel = Maven2ModelConverter.toNativeModel(model);
Collection<String> enabledProfiles = explicitProfiles.getEnabledProfiles();
Collection<String> disabledProfiles = explicitProfiles.getDisabledProfiles();
List<Profile> activatedPom = new ArrayList<Profile>();
List<Profile> activatedExternal = new ArrayList<Profile>();
List<Profile> activeByDefault = new ArrayList<Profile>();
List<Profile> rawProfiles = nativeModel.getProfiles();
List<Profile> expandedProfilesCache = null;
List<Profile> deactivatedProfiles = new ArrayList<Profile>();
for (int i = 0; i < rawProfiles.size(); i++) {
Profile eachRawProfile = rawProfiles.get(i);
if (disabledProfiles.contains(eachRawProfile.getId())) {
deactivatedProfiles.add(eachRawProfile);
continue;
}
boolean shouldAdd = enabledProfiles.contains(eachRawProfile.getId()) || alwaysOnProfiles.contains(eachRawProfile.getId());
Activation activation = eachRawProfile.getActivation();
if (activation != null) {
if (activation.isActiveByDefault()) {
activeByDefault.add(eachRawProfile);
}
// expand only if necessary
if (expandedProfilesCache == null) expandedProfilesCache = doInterpolate(nativeModel, basedir).getProfiles();
Profile eachExpandedProfile = expandedProfilesCache.get(i);
for (ProfileActivator eachActivator : getProfileActivators(basedir)) {
try {
if (eachActivator.canDetermineActivation(eachExpandedProfile) && eachActivator.isActive(eachExpandedProfile)) {
shouldAdd = true;
break;
}
}
catch (ProfileActivationException e) {
Maven2ServerGlobals.getLogger().warn(e);
}
}
}
if (shouldAdd) {
if (MavenConstants.PROFILE_FROM_POM.equals(eachRawProfile.getSource())) {
activatedPom.add(eachRawProfile);
}
else {
activatedExternal.add(eachRawProfile);
}
}
}
List<Profile> activatedProfiles = new ArrayList<Profile>(activatedPom.isEmpty() ? activeByDefault : activatedPom);
activatedProfiles.addAll(activatedExternal);
for (Profile each : activatedProfiles) {
new DefaultProfileInjector().inject(each, nativeModel);
}
return new ProfileApplicationResult(Maven2ModelConverter.convertModel(nativeModel, null),
new MavenExplicitProfiles(collectProfilesIds(activatedProfiles),
collectProfilesIds(deactivatedProfiles))
);
}
示例6: applyProfiles
import org.apache.maven.model.Activation; //导入方法依赖的package包/类
public static ProfileApplicationResult applyProfiles(MavenModel model,
File basedir,
Collection<String> explicitProfiles,
Collection<String> alwaysOnProfiles) throws RemoteException {
Model nativeModel = MavenModelConverter.toNativeModel(model);
List<Profile> activatedPom = new ArrayList<Profile>();
List<Profile> activatedExternal = new ArrayList<Profile>();
List<Profile> activeByDefault = new ArrayList<Profile>();
List<Profile> rawProfiles = nativeModel.getProfiles();
List<Profile> expandedProfilesCache = null;
for (int i = 0; i < rawProfiles.size(); i++) {
Profile eachRawProfile = rawProfiles.get(i);
boolean shouldAdd = explicitProfiles.contains(eachRawProfile.getId()) || alwaysOnProfiles.contains(eachRawProfile.getId());
Activation activation = eachRawProfile.getActivation();
if (activation != null) {
if (activation.isActiveByDefault()) {
activeByDefault.add(eachRawProfile);
}
// expand only if necessary
if (expandedProfilesCache == null) expandedProfilesCache = doInterpolate(nativeModel, basedir).getProfiles();
Profile eachExpandedProfile = expandedProfilesCache.get(i);
for (ProfileActivator eachActivator : getProfileActivators(basedir)) {
try {
if (eachActivator.canDetermineActivation(eachExpandedProfile) && eachActivator.isActive(eachExpandedProfile)) {
shouldAdd = true;
break;
}
}
catch (ProfileActivationException e) {
Maven3ServerGlobals.getLogger().warn(e);
}
}
}
if (shouldAdd) {
if (MavenConstants.PROFILE_FROM_POM.equals(eachRawProfile.getSource())) {
activatedPom.add(eachRawProfile);
}
else {
activatedExternal.add(eachRawProfile);
}
}
}
List<Profile> activatedProfiles = new ArrayList<Profile>(activatedPom.isEmpty() ? activeByDefault : activatedPom);
activatedProfiles.addAll(activatedExternal);
for (Profile each : activatedProfiles) {
new DefaultProfileInjector().injectProfile(nativeModel, each, null, null);
}
return new ProfileApplicationResult(MavenModelConverter.convertModel(nativeModel, null),
collectProfilesIds(activatedProfiles));
}
示例7: applyProfiles
import org.apache.maven.model.Activation; //导入方法依赖的package包/类
public static ProfileApplicationResult applyProfiles(MavenModel model,
File basedir,
Collection<String> explicitProfiles,
Collection<String> alwaysOnProfiles) throws RemoteException {
Model nativeModel = Maven2ModelConverter.toNativeModel(model);
List<Profile> activatedPom = new ArrayList<Profile>();
List<Profile> activatedExternal = new ArrayList<Profile>();
List<Profile> activeByDefault = new ArrayList<Profile>();
List<Profile> rawProfiles = nativeModel.getProfiles();
List<Profile> expandedProfilesCache = null;
for (int i = 0; i < rawProfiles.size(); i++) {
Profile eachRawProfile = rawProfiles.get(i);
boolean shouldAdd = explicitProfiles.contains(eachRawProfile.getId()) || alwaysOnProfiles.contains(eachRawProfile.getId());
Activation activation = eachRawProfile.getActivation();
if (activation != null) {
if (activation.isActiveByDefault()) {
activeByDefault.add(eachRawProfile);
}
// expand only if necessary
if (expandedProfilesCache == null) expandedProfilesCache = doInterpolate(nativeModel, basedir).getProfiles();
Profile eachExpandedProfile = expandedProfilesCache.get(i);
for (ProfileActivator eachActivator : getProfileActivators(basedir)) {
try {
if (eachActivator.canDetermineActivation(eachExpandedProfile) && eachActivator.isActive(eachExpandedProfile)) {
shouldAdd = true;
break;
}
}
catch (ProfileActivationException e) {
Maven2ServerGlobals.getLogger().warn(e);
}
}
}
if (shouldAdd) {
if (MavenConstants.PROFILE_FROM_POM.equals(eachRawProfile.getSource())) {
activatedPom.add(eachRawProfile);
}
else {
activatedExternal.add(eachRawProfile);
}
}
}
List<Profile> activatedProfiles = new ArrayList<Profile>(activatedPom.isEmpty() ? activeByDefault : activatedPom);
activatedProfiles.addAll(activatedExternal);
for (Profile each : activatedProfiles) {
new DefaultProfileInjector().inject(each, nativeModel);
}
return new ProfileApplicationResult(Maven2ModelConverter.convertModel(nativeModel, null),
collectProfilesIds(activatedProfiles));
}
示例8: isActiveByDefault
import org.apache.maven.model.Activation; //导入方法依赖的package包/类
private boolean isActiveByDefault( Profile profile )
{
Activation activation = profile.getActivation();
return activation != null && activation.isActiveByDefault();
}