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


Java Profile类代码示例

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


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

示例1: build

import org.apache.maven.model.Profile; //导入依赖的package包/类
@Override
public ModelBuildingResult build(ModelBuildingRequest request) throws ModelBuildingException {
    ModelBuildingResult toRet = super.build(request);
    Model eff = toRet.getEffectiveModel();
    InputSource source = new InputSource();
    source.setLocation("");
    InputLocation location = new InputLocation(-1, -1, source);
    eff.setLocation(NETBEANS_PROFILES, location);
    for (String id : toRet.getModelIds()) {
        Model mdl = toRet.getRawModel(id);
        for (Profile p : mdl.getProfiles()) {
            source.setLocation(source.getLocation() + "|" + p.getId());
        }
    }
    return toRet;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:17,代码来源:NBModelBuilder.java

示例2: updateProfile

import org.apache.maven.model.Profile; //导入依赖的package包/类
/**
 * Method updateProfile
 *
 * @param value
 * @param element
 * @param counter
 * @param xmlTag
 */
protected void updateProfile( Profile value, String xmlTag, Counter counter, Element element )
{
    Element root = element;
    Counter innerCount = new Counter( counter.getDepth() + 1 );
    findAndReplaceSimpleElement( innerCount, root, "id", value.getId(), "default" );
    // updateActivation( value.getActivation(), "activation", innerCount, root);
    updateBuildBase( value.getBuild(), "build", innerCount, root );
    findAndReplaceSimpleLists( innerCount, root, value.getModules(), "modules", "module" );
    iterateRepository( innerCount, root, value.getRepositories(), "repositories", "repository" );
    iterateRepository( innerCount, root, value.getPluginRepositories(), "pluginRepositories", "pluginRepository" );
    iterateDependency( innerCount, root, value.getDependencies(), "dependencies", "dependency" );
    findAndReplaceXpp3DOM( innerCount, root, "reports", (Xpp3Dom) value.getReports() );
    updateReporting( value.getReporting(), "reporting", innerCount, root );
    updateDependencyManagement( value.getDependencyManagement(), "dependencyManagement", innerCount, root );
    updateDistributionManagement( value.getDistributionManagement(), "distributionManagement", innerCount, root );
    findAndReplaceProperties( innerCount, root, "properties", value.getProperties() );
}
 
开发者ID:javiersigler,项目名称:apache-maven-shade-plugin,代码行数:26,代码来源:MavenJDOMWriter.java

示例3: addProfiles

import org.apache.maven.model.Profile; //导入依赖的package包/类
public static void addProfiles(Model pomModel) {
    Profile profile = new Profile();
    profile.setId("milestone");
    DistributionManagement milestoneDistManagement = new DistributionManagement();

    DeploymentRepository milestoneRepo = new DeploymentRepository();
    milestoneRepo.setId("repo.spring.io");
    milestoneRepo.setName("Spring Milestone Repository");
    milestoneRepo.setUrl("https://repo.spring.io/libs-milestone-local");
    milestoneDistManagement.setRepository(milestoneRepo);
    profile.setDistributionManagement(milestoneDistManagement);
    List<Profile> profiles = new ArrayList<>();
    profiles.add(profile);

    profiles.add(centralProfile());

    pomModel.setProfiles(profiles);
}
 
开发者ID:spring-cloud,项目名称:spring-cloud-stream-app-maven-plugin,代码行数:19,代码来源:MavenModelUtils.java

示例4: getSnapshotsFromManagement

import org.apache.maven.model.Profile; //导入依赖的package包/类
private Multimap<ArtifactCoordinates, ArtifactCoordinates> getSnapshotsFromManagement(Profile profile,
    PomPropertyResolver propertyResolver) {
  this.log.debug("\t\tChecking managed plugins of profile '" + profile.getId() + "'");
  Multimap<ArtifactCoordinates, ArtifactCoordinates> result = HashMultimap.create();
  BuildBase build = profile.getBuild();
  if (build != null) {
    PluginManagement pluginManagement = build.getPluginManagement();
    if (pluginManagement != null) {
      for (Plugin plugin : pluginManagement.getPlugins()) {
        Collection<Dependency> snapshots = Collections2.filter(plugin.getDependencies(),
            new IsSnapshotDependency(propertyResolver));
        if (!snapshots.isEmpty()) {
          result.putAll(PluginToCoordinates.INSTANCE.apply(plugin),
              Collections2.transform(snapshots, DependencyToCoordinates.INSTANCE));
        }
      }
    }
  }
  return result;
}
 
开发者ID:shillner,项目名称:unleash-maven-plugin,代码行数:21,代码来源:CheckPluginDependencyVersions.java

示例5: getSnapshots

import org.apache.maven.model.Profile; //导入依赖的package包/类
private Multimap<ArtifactCoordinates, ArtifactCoordinates> getSnapshots(Profile profile,
    PomPropertyResolver propertyResolver) {
  this.log.debug("\t\tChecking direct plugin references of profile '" + profile.getId() + "'");
  Multimap<ArtifactCoordinates, ArtifactCoordinates> result = HashMultimap.create();
  BuildBase build = profile.getBuild();
  if (build != null) {
    for (Plugin plugin : build.getPlugins()) {
      Collection<Dependency> snapshots = Collections2.filter(plugin.getDependencies(),
          new IsSnapshotDependency(propertyResolver));
      if (!snapshots.isEmpty()) {
        result.putAll(PluginToCoordinates.INSTANCE.apply(plugin),
            Collections2.transform(snapshots, DependencyToCoordinates.INSTANCE));
      }
    }
  }
  return result;
}
 
开发者ID:shillner,项目名称:unleash-maven-plugin,代码行数:18,代码来源:CheckPluginDependencyVersions.java

示例6: collectActivatedProfiles

import org.apache.maven.model.Profile; //导入依赖的package包/类
private static Collection<String> collectActivatedProfiles(MavenProject mavenProject)
  throws RemoteException {
  // for some reason project's active profiles do not contain parent's profiles - only local and settings'.
  // parent's profiles do not contain settings' profiles.

  List<Profile> profiles = new ArrayList<Profile>();
  try {
    while (mavenProject != null) {
      profiles.addAll(mavenProject.getActiveProfiles());
      mavenProject = mavenProject.getParent();
    }
  }
  catch (Exception e) {
    // don't bother user if maven failed to build parent project
    Maven3ServerGlobals.getLogger().info(e);
  }
  return collectProfilesIds(profiles);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:19,代码来源:Maven30ServerEmbedderImpl.java

示例7: addProjectAsModule

import org.apache.maven.model.Profile; //导入依赖的package包/类
/**
 * Add a project as a module.
 * 
 * @param pom
 * @param relativePath
 * @param logger
 * @throws IOException
 * @throws XmlPullParserException
 */
public static void addProjectAsModule(File pom, String relativePath, String profileId, Log logger) throws IOException, XmlPullParserException {
	if (relativePath == null) return;

	Model model = getModelFromPOM(pom, logger);

	relativePath = relativePath.replace("\\", "/");

	if (profileId != null && !profileId.isEmpty()) {
		Profile p = getProfile(model, profileId);
		if (p != null) {
			p.addModule(relativePath);
		}
	} else {
		model.addModule(relativePath);
	}
	
	writeModelToPOM(model, pom, logger);
}
 
开发者ID:fastconnect,项目名称:tibco-bwmaven,代码行数:28,代码来源:POMManager.java

示例8: removeProjectAsModule

import org.apache.maven.model.Profile; //导入依赖的package包/类
public static void removeProjectAsModule(File pom, String relativePath,	String profileId, Log logger) throws IOException, XmlPullParserException {
	if (relativePath == null) return;
	
	Model model = getModelFromPOM(pom, logger);
	
	relativePath = relativePath.replace("\\", "/");
	if (profileId != null && !profileId.isEmpty()) {
		Profile p = getProfile(model, profileId);
		if (p != null) {
			p.removeModule(relativePath);
		}
	} else {
		model.removeModule(relativePath);
	}
	
	writeModelToPOM(model, pom, logger);
}
 
开发者ID:fastconnect,项目名称:tibco-bwmaven,代码行数:18,代码来源:POMManager.java

示例9: moduleExists

import org.apache.maven.model.Profile; //导入依赖的package包/类
/**
 * Check whether a module exists in a POM.
 * 
 * @param rootPOM
 * @param relative
 * @param log
 * @return 
 * @throws XmlPullParserException 
 * @throws IOException 
 */
public static boolean moduleExists(File pom, String relativePath, String profileId, Log logger) throws IOException, XmlPullParserException {
	if (relativePath == null) return false;

	Model model = getModelFromPOM(pom, logger);
	
	relativePath = relativePath.replace("\\", "/");

	if (profileId != null && !profileId.isEmpty()) {
		Profile p = getProfile(model, profileId);
		if (p != null) {
			return p.getModules().indexOf(relativePath) >= 0;
		}
	} else {
		return model.getModules().indexOf(relativePath) >= 0;
	}

	return false;
}
 
开发者ID:fastconnect,项目名称:tibco-bwmaven,代码行数:29,代码来源:POMManager.java

示例10: getActiveModules

import org.apache.maven.model.Profile; //导入依赖的package包/类
private List<String> getActiveModules(List<Profile> activeProfiles, Model model) {
	List<String> modules = model.getModules();

	for (Profile profile : model.getProfiles()) {
		Boolean found = false;
		for (Profile p : activeProfiles) {
			if (p.getId().equals(profile.getId())) {
				found = true;
				break;
			}
		}
		if (!found) continue;

		for (String module : profile.getModules()) {
			if (modules.indexOf(module) < 0) {
				modules.add(module);
			}
		}
	}

	return modules;
}
 
开发者ID:fastconnect,项目名称:tibco-bwmaven,代码行数:23,代码来源:GenerateRootDeploymentPOM.java

示例11: addModules

import org.apache.maven.model.Profile; //导入依赖的package包/类
private List<String> addModules(String basedir, Model model, List<Profile> activeProfiles, List<MavenProject> activeProjects) throws IOException, XmlPullParserException {
	List<String> result = new ArrayList<String>();

	List<String> modules = getActiveModules(activeProfiles, model);

	for (String module : modules) {
		String childFileName = basedir + module + File.separator + "pom.xml";
		if (!new File(childFileName).exists()) continue;

		// load the model of the module
		Model child = POMManager.getModelFromPOM(new File(childFileName), getLog());
		if (child.getPackaging().equals(BWEAR_TYPE)) { // add POMs with "bw-ear" packaging
			if (isProjectActive(child, activeProjects) != null) { // exclude inactive projects (if -am command line switch is used)

				String relativePath = getModuleRelativePath(child);
				result.add(applicationsRoot + MODULE_SEPARATOR + relativePath);
			}
		} else if (child.getPackaging().equals(POM_TYPE)) {
			// recursively add children found in POMs with "pom" packaging
			result.addAll(addModules(basedir + module + File.separator, child, activeProfiles, activeProjects));
		}
	}

	return result;
}
 
开发者ID:fastconnect,项目名称:tibco-bwmaven,代码行数:26,代码来源:GenerateRootDeploymentPOM.java

示例12: execute

import org.apache.maven.model.Profile; //导入依赖的package包/类
/** {@inheritDoc} */
public void execute()
    throws MojoExecutionException
{
    validateOutputFile();
    List<?> list = getProject().getActiveProfiles();
    if ( getLog().isInfoEnabled() )
    {
        getLog().debug( list.size() + " profile(s) active" );
    }
    Properties properties = new Properties();
    for ( Iterator<?> iter = list.iterator(); iter.hasNext(); )
    {
        Profile profile = (Profile) iter.next();
        if ( profile.getProperties() != null )
        {
            properties.putAll( profile.getProperties() );
        }
    }

    writeProperties( properties, getOutputFile() );
}
 
开发者ID:mojohaus,项目名称:properties-maven-plugin,代码行数:23,代码来源:WriteActiveProfileProperties.java

示例13: getDefinedActiveBuilds

import org.apache.maven.model.Profile; //导入依赖的package包/类
private Set<BuildBase> getDefinedActiveBuilds(MavenProject project) {
    HashSet<BuildBase> activeBuilds = new HashSet<>();
    final Model originalModel = project.getOriginalModel();
    final Build build = originalModel.getBuild();
    activeBuilds.add(build);

    final List<Profile> originalProfiles = originalModel.getProfiles();
    if (originalProfiles != null) {
        for (Profile profile : project.getActiveProfiles()) {
            // check active profile is defined in project
            for (Profile originalProfile : originalProfiles) {
                if (originalProfile.equals(profile)) {
                    activeBuilds.add(originalProfile.getBuild());
                }
            }
        }
    }
    // remove possible null entries
    activeBuilds.remove(null);
    return activeBuilds;
}
 
开发者ID:1and1,项目名称:ono-extra-enforcer-rules,代码行数:22,代码来源:AbstractRule.java

示例14: getActiveProfiles

import org.apache.maven.model.Profile; //导入依赖的package包/类
private List<String> getActiveProfiles(MavenProject project) throws RemoteException {
  List<Profile> profiles = new ArrayList<>();

  try {
    while (project != null) {
      profiles.addAll(project.getActiveProfiles());
      project = project.getParent();
    }
  } catch (Exception e) {
    MavenServerContext.getLogger().info(e);
  }

  return profiles
      .stream()
      .filter(p -> p.getId() != null)
      .map(Profile::getId)
      .collect(Collectors.toList());
}
 
开发者ID:eclipse,项目名称:che,代码行数:19,代码来源:MavenServerImpl.java

示例15: transformableWithDiscardAnyReference

import org.apache.maven.model.Profile; //导入依赖的package包/类
public void transformableWithDiscardAnyReference() throws IOException {
    PomTransformer pomTransformer = new PomTransformer(transformablePomAsString,
            PomCleanupPolicy.discard_any_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) {
        List profileRepositories = profile.getRepositories();
        List profilePluginsRepositories = profile.getPluginRepositories();

        assertEmptyList(profileRepositories, profilePluginsRepositories);
    }
    assertTrue(transformablePomAsString.contains("This is a comment"));
    compareChecksums(transformablePomAsString, transformedPom, false);
}
 
开发者ID:alancnet,项目名称:artifactory,代码行数:22,代码来源:PomTransformerTest.java


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