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


Java DefaultModelBuilderFactory类代码示例

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


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

示例1: updateDependencyResolutionContext

import org.apache.maven.model.building.DefaultModelBuilderFactory; //导入依赖的package包/类
private void updateDependencyResolutionContext(
		List<Map<String, String>> bomDependencies) {
	URI[] uris = Grape.getInstance().resolve(null,
			bomDependencies.toArray(new Map[bomDependencies.size()]));
	DefaultModelBuilder modelBuilder = new DefaultModelBuilderFactory().newInstance();
	for (URI uri : uris) {
		try {
			DefaultModelBuildingRequest request = new DefaultModelBuildingRequest();
			request.setModelResolver(new GrapeModelResolver());
			request.setModelSource(new UrlModelSource(uri.toURL()));
			request.setSystemProperties(System.getProperties());
			Model model = modelBuilder.build(request).getEffectiveModel();
			this.resolutionContext.addDependencyManagement(
					new MavenModelDependencyManagement(model));
		}
		catch (Exception ex) {
			throw new IllegalStateException("Failed to build model for '" + uri
					+ "'. Is it a valid Maven bom?", ex);
		}
	}
}
 
开发者ID:vikrammane23,项目名称:https-github.com-g0t4-jenkins2-course-spring-boot,代码行数:22,代码来源:DependencyManagementBomTransformation.java

示例2: Resolver

import org.apache.maven.model.building.DefaultModelBuilderFactory; //导入依赖的package包/类
public Resolver(ArtifactConfig config) {
  this.modelBuilder =
      new DefaultModelBuilderFactory()
          .newInstance()
          .setProfileSelector(new DefaultProfileSelector())
          .setPluginConfigurationExpander(new DefaultPluginConfigurationExpander())
          .setPluginManagementInjector(new DefaultPluginManagementInjector())
          .setDependencyManagementImporter(new DefaultDependencyManagementImporter())
          .setDependencyManagementInjector(new DefaultDependencyManagementInjector());
  ServiceLocator locator = AetherUtil.initServiceLocator();
  this.repoSys = locator.getService(RepositorySystem.class);
  this.localRepo = new LocalRepository(Paths.get(config.mavenLocalRepo).toFile());
  this.session = newSession(repoSys, localRepo);

  this.buckRepoRoot = Paths.get(Preconditions.checkNotNull(config.buckRepoRoot));
  this.buckThirdPartyRelativePath = Paths.get(Preconditions.checkNotNull(config.thirdParty));
  this.visibility = config.visibility;

  this.repos =
      config
          .repositories
          .stream()
          .map(AetherUtil::toRemoteRepository)
          .collect(ImmutableList.toImmutableList());
}
 
开发者ID:facebook,项目名称:buck,代码行数:26,代码来源:Resolver.java

示例3: initialize

import org.apache.maven.model.building.DefaultModelBuilderFactory; //导入依赖的package包/类
@PostConstruct
public void initialize()
    throws PlexusSisuBridgeException
{
    factory = plexusSisuBridge.lookup( ArtifactFactory.class, "default" );

    DefaultModelBuilderFactory defaultModelBuilderFactory = new DefaultModelBuilderFactory();
    builder = defaultModelBuilderFactory.newInstance();
}
 
开发者ID:ruikom,项目名称:apache-archiva,代码行数:10,代码来源:Maven3DependencyTreeBuilder.java

示例4: getRepositorySystem

import org.apache.maven.model.building.DefaultModelBuilderFactory; //导入依赖的package包/类
public RepositorySystem getRepositorySystem()
{

   final DefaultServiceLocator locator = MavenRepositorySystemUtils.newServiceLocator();
   locator.setServices(ModelBuilder.class, new DefaultModelBuilderFactory().newInstance());
   // Installing Wagon to fetch from HTTP repositories
   locator.setServices(WagonProvider.class, new ManualWagonProvider());
   locator.addService(TransporterFactory.class, WagonTransporterFactory.class);
   locator.addService(RepositoryConnectorFactory.class, BasicRepositoryConnectorFactory.class);
   final RepositorySystem repositorySystem = locator.getService(RepositorySystem.class);
   return repositorySystem;
}
 
开发者ID:forge,项目名称:furnace,代码行数:13,代码来源:MavenContainer.java

示例5: loadPomFromFile

import org.apache.maven.model.building.DefaultModelBuilderFactory; //导入依赖的package包/类
public Model loadPomFromFile(File pomFile, String... profiles)
{
   RepositorySystem system = mavenContainer.getRepositorySystem();
   Settings settings = mavenContainer.getSettings();
   DefaultRepositorySystemSession session = mavenContainer.setupRepoSession(system, settings);
   final DefaultModelBuildingRequest request = new DefaultModelBuildingRequest()
            .setSystemProperties(System.getProperties())
            .setPomFile(pomFile)
            .setActiveProfileIds(settings.getActiveProfiles());
   ModelBuilder builder = new DefaultModelBuilderFactory().newInstance();
   ModelBuildingResult result;
   try
   {
      request.setModelResolver(new MavenModelResolver(system, session,
               MavenRepositories.getRemoteRepositories(mavenContainer, settings)));
      result = builder.build(request);
   }
   // wrap exception message
   catch (ModelBuildingException e)
   {
      String pomPath = request.getPomFile().getAbsolutePath();
      StringBuilder sb = new StringBuilder("Found ").append(e.getProblems().size())
               .append(" problems while building POM model from ").append(pomPath).append("\n");

      int counter = 1;
      for (ModelProblem problem : e.getProblems())
      {
         sb.append(counter++).append("/ ").append(problem).append("\n");
      }

      throw new RuntimeException(sb.toString());
   }
   return result.getEffectiveModel();
}
 
开发者ID:forge,项目名称:furnace,代码行数:35,代码来源:ProjectHelper.java

示例6: initService

import org.apache.maven.model.building.DefaultModelBuilderFactory; //导入依赖的package包/类
public void initService( ServiceLocator locator )
{
    setLogger( locator.getService( Logger.class ) );
    setRemoteRepositoryManager( locator.getService( RemoteRepositoryManager.class ) );
    setVersionResolver( locator.getService( VersionResolver.class ) );
    setArtifactResolver( locator.getService( ArtifactResolver.class ) );
    setRepositoryEventDispatcher( locator.getService( RepositoryEventDispatcher.class ) );
    modelBuilder = locator.getService( ModelBuilder.class );
    if ( modelBuilder == null )
    {
        setModelBuilder( new DefaultModelBuilderFactory().newInstance() );
    }
}
 
开发者ID:gems-uff,项目名称:oceano,代码行数:14,代码来源:DefaultArtifactDescriptorReader.java

示例7: getRepositorySystem

import org.apache.maven.model.building.DefaultModelBuilderFactory; //导入依赖的package包/类
public RepositorySystem getRepositorySystem()
{

   final DefaultServiceLocator locator = MavenRepositorySystemUtils.newServiceLocator();
   locator.setServices(ModelBuilder.class, new DefaultModelBuilderFactory().newInstance());
   // Installing Wagon to fetch from HTTP repositories
   locator.setServices(WagonProvider.class, new ManualWagonProvider());
   locator.addService(RepositoryConnectorFactory.class, WagonRepositoryConnectorFactory.class);
   final RepositorySystem repositorySystem = locator.getService(RepositorySystem.class);
   return repositorySystem;
}
 
开发者ID:koentsje,项目名称:forge-furnace,代码行数:12,代码来源:MavenContainer.java

示例8: loadPomFromFile

import org.apache.maven.model.building.DefaultModelBuilderFactory; //导入依赖的package包/类
public Model loadPomFromFile(File pomFile, String... profiles)
{
   RepositorySystem system = mavenContainer.getRepositorySystem();
   Settings settings = mavenContainer.getSettings();
   DefaultRepositorySystemSession session = mavenContainer.setupRepoSession(system, settings);
   final DefaultModelBuildingRequest request = new DefaultModelBuildingRequest()
            .setSystemProperties(System.getProperties())
            .setPomFile(pomFile)
            .setActiveProfileIds(settings.getActiveProfiles());
   ModelBuilder builder = new DefaultModelBuilderFactory().newInstance();
   ModelBuildingResult result;
   try
   {
      request.setModelResolver(new MavenModelResolver(system, session, mavenContainer
               .getEnabledRepositoriesFromProfile(settings)));
      result = builder.build(request);
   }
   // wrap exception message
   catch (ModelBuildingException e)
   {
      String pomPath = request.getPomFile().getAbsolutePath();
      StringBuilder sb = new StringBuilder("Found ").append(e.getProblems().size())
               .append(" problems while building POM model from ").append(pomPath).append("\n");

      int counter = 1;
      for (ModelProblem problem : e.getProblems())
      {
         sb.append(counter++).append("/ ").append(problem).append("\n");
      }

      throw new RuntimeException(sb.toString());
   }
   return result.getEffectiveModel();
}
 
开发者ID:koentsje,项目名称:forge-furnace,代码行数:35,代码来源:ProjectHelper.java

示例9: initialize

import org.apache.maven.model.building.DefaultModelBuilderFactory; //导入依赖的package包/类
@PostConstruct
public void initialize()
{
    builder = new DefaultModelBuilderFactory().newInstance();

}
 
开发者ID:ruikom,项目名称:apache-archiva,代码行数:7,代码来源:Maven2RepositoryStorage.java


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