org.apache.maven.model.io.ModelReader Java Examples

The following examples show how to use org.apache.maven.model.io.ModelReader. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: DependencyResolver.java    From spring-init with Apache License 2.0 6 votes vote down vote up
@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);
}
 
Example #2
Source File: DependencyResolver.java    From spring-cloud-function with Apache License 2.0 6 votes vote down vote up
@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);
}
 
Example #3
Source File: POMManager.java    From netbeans with Apache License 2.0 5 votes vote down vote up
public POMManager(String inputResource, Project project) {
    this(project, false);
    try {
        //source
        ModelReader reader = EmbedderFactory.getProjectEmbedder().lookupComponent(ModelReader.class);
        sourceModel = reader.read(loadResource(inputResource), Collections.singletonMap(ModelReader.IS_STRICT, false));
    } catch (IOException ex) {
        Exceptions.printStackTrace(ex);
    }
}
 
Example #4
Source File: POMManager.java    From netbeans with Apache License 2.0 5 votes vote down vote up
public POMManager(Reader inputResource, Project project) {
    this(project, false);
    try {
        //source
        ModelReader reader = EmbedderFactory.getProjectEmbedder().lookupComponent(ModelReader.class);
        sourceModel = reader.read(inputResource, Collections.singletonMap(ModelReader.IS_STRICT, false));
    } catch (IOException ex) {
        Exceptions.printStackTrace(ex);
    }
}
 
Example #5
Source File: ModelReaderTest.java    From JQF with BSD 2-Clause "Simplified" License 5 votes vote down vote up
@Fuzz
public void testWithInputStream(InputStream in) {
    ModelReader reader = new DefaultModelReader();
    try {
        Model model = reader.read(in, null);
        Assert.assertNotNull(model);
    } catch (IOException e) {
        Assume.assumeNoException(e);
    }
}
 
Example #6
Source File: POMManager.java    From jeddict with Apache License 2.0 5 votes vote down vote up
@Override
public POMManager copy(String... inputResources) {
    Map<String, ?> properties = Collections.singletonMap(ModelReader.IS_STRICT, false);
    ModelReader reader = EmbedderFactory.getProjectEmbedder().lookupComponent(ModelReader.class);
    for (String inputResource : inputResources) {
        try {
            //source
            sourceModels.add(reader.read(FileUtil.loadResource(inputResource), properties));
        } catch (IOException ex) {
            Exceptions.printStackTrace(ex);
        }
    }
    return this;
}
 
Example #7
Source File: POMManager.java    From jeddict with Apache License 2.0 5 votes vote down vote up
@Override
public POMManager copy(Reader... inputResources) {
    Map<String, ?> properties = Collections.singletonMap(ModelReader.IS_STRICT, false);
    ModelReader reader = EmbedderFactory.getProjectEmbedder().lookupComponent(ModelReader.class);
    for (Reader inputResource : inputResources) {
        try {
            //source
            sourceModels.add(reader.read(inputResource, properties));
        } catch (IOException ex) {
            Exceptions.printStackTrace(ex);
        }
    }
    return this;
}