本文整理汇总了Java中org.apache.maven.model.locator.DefaultModelLocator类的典型用法代码示例。如果您正苦于以下问题:Java DefaultModelLocator类的具体用法?Java DefaultModelLocator怎么用?Java DefaultModelLocator使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
DefaultModelLocator类属于org.apache.maven.model.locator包,在下文中一共展示了DefaultModelLocator类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: resolvePomDependencies
import org.apache.maven.model.locator.DefaultModelLocator; //导入依赖的package包/类
/**
* Given a local path to a Maven project, this attempts to find the transitive dependencies of the
* project.
*
* @param projectPath The path to search for Maven projects.
* @param scopes The scopes to look up dependencies in.
*/
public String resolvePomDependencies(String projectPath, Set<String> scopes) {
DefaultModelProcessor processor = new DefaultModelProcessor();
processor.setModelLocator(new DefaultModelLocator());
processor.setModelReader(new DefaultModelReader());
File pom = processor.locatePom(new File(projectPath));
FileModelSource pomSource = new FileModelSource(pom);
// First resolve the model source locations.
resolveSourceLocations(pomSource);
// Next, fully resolve the models.
Model model = modelResolver.getEffectiveModel(pomSource);
if (model != null) {
traverseDeps(model, scopes, Sets.newHashSet(), null);
}
return pom.getAbsolutePath();
}
示例2: configure
import org.apache.maven.model.locator.DefaultModelLocator; //导入依赖的package包/类
@Override
protected void configure() {
bind(ModelLocator.class).to(DefaultModelLocator.class).in(Singleton.class);
bind(ModelReader.class).to(DefaultModelReader.class).in(Singleton.class);
bind(ModelValidator.class).to(DefaultModelValidator.class).in(Singleton.class);
bind(RepositoryConnectorFactory.class).to(BasicRepositoryConnectorFactory.class)
.in(Singleton.class);
bind(ArtifactDescriptorReader.class) //
.to(DefaultArtifactDescriptorReader.class).in(Singleton.class);
bind(VersionResolver.class) //
.to(DefaultVersionResolver.class).in(Singleton.class);
bind(VersionRangeResolver.class) //
.to(DefaultVersionRangeResolver.class).in(Singleton.class);
bind(MetadataGeneratorFactory.class).annotatedWith(Names.named("snapshot")) //
.to(SnapshotMetadataGeneratorFactory.class).in(Singleton.class);
bind(MetadataGeneratorFactory.class).annotatedWith(Names.named("versions")) //
.to(VersionsMetadataGeneratorFactory.class).in(Singleton.class);
bind(TransporterFactory.class).annotatedWith(Names.named("http"))
.to(HttpTransporterFactory.class).in(Singleton.class);
bind(TransporterFactory.class).annotatedWith(Names.named("file"))
.to(FileTransporterFactory.class).in(Singleton.class);
}
示例3: locatePom
import org.apache.maven.model.locator.DefaultModelLocator; //导入依赖的package包/类
@Override
public File locatePom(File projectDirectory) {
try {
File pomFile = new DefaultModelLocator().locatePom(projectDirectory);
if (stamper.isEnabled()) {
logger.info("[FreezeModelLocator]: Freeze pom in folder " + projectDirectory.getAbsolutePath());
artifactFreezeMapping.put(pomFile);
logger.debug("[FreezeModelLocator]: Freezing pom " + pomFile.getAbsolutePath());
return pomFreezer.freeze(pomFile);
} else {
return pomFile;
}
} catch (RuntimeException e) {
throw new FreezeException("Unable to locate " +
(stamper.isEnabled() ? " frozen " : "") +
"pom in directory [" + projectDirectory + "] ...", e);
}
}
示例4: readModel
import org.apache.maven.model.locator.DefaultModelLocator; //导入依赖的package包/类
private static Model readModel() {
DefaultModelProcessor modelProcessor = new DefaultModelProcessor();
modelProcessor.setModelLocator(new DefaultModelLocator());
modelProcessor.setModelReader(new DefaultModelReader());
try {
return modelProcessor.read(SpringBootDependenciesDependencyManagement.class
.getResourceAsStream("effective-pom.xml"), null);
}
catch (IOException ex) {
throw new IllegalStateException("Failed to build model from effective pom",
ex);
}
}
开发者ID:vikrammane23,项目名称:https-github.com-g0t4-jenkins2-course-spring-boot,代码行数:15,代码来源:SpringBootDependenciesDependencyManagement.java
示例5: newModelLocator
import org.apache.maven.model.locator.DefaultModelLocator; //导入依赖的package包/类
protected ModelLocator newModelLocator()
{
return new DefaultModelLocator();
}