Example usage for org.apache.maven.project ProjectUtils buildArtifactRepositories

List of usage examples for org.apache.maven.project ProjectUtils buildArtifactRepositories

Introduction

In this page you can find the example usage for org.apache.maven.project ProjectUtils buildArtifactRepositories.

Prototype

public static List<ArtifactRepository> buildArtifactRepositories(List<Repository> repositories,
            ArtifactRepositoryFactory artifactRepositoryFactory, PlexusContainer c)
            throws InvalidRepositoryException 

Source Link

Usage

From source file:org.apache.cxf.maven_plugin.WSDL2JavaMojo.java

License:Apache License

public void downloadRemoteWsdls(List<WsdlOption> effectiveWsdlOptions) throws MojoExecutionException {
    List remoteRepos;//from   ww w.  ja v a  2  s . c o  m
    try {
        remoteRepos = ProjectUtils.buildArtifactRepositories(repositories, artifactRepositoryFactory,
                mavenSession.getContainer());
    } catch (InvalidRepositoryException e) {
        throw new MojoExecutionException("Error build repositories for remote wsdls", e);
    }

    for (WsdlOption wsdlOption : effectiveWsdlOptions) {
        WsdlArtifact wsdlA = wsdlOption.getWsdlArtifact();
        if (wsdlA == null) {
            return;
        }
        Artifact wsdlArtifact = artifactFactory.createArtifact(wsdlA.getGroupId(), wsdlA.getArtifactId(),
                wsdlA.getVersion(), Artifact.SCOPE_COMPILE, wsdlA.getType());
        wsdlArtifact = resolveRemoteWsdlArtifact(remoteRepos, wsdlArtifact);
        if (wsdlArtifact != null) {
            String path = wsdlArtifact.getFile().getAbsolutePath();
            getLog().info("Resolved WSDL artifact to file " + path);
            wsdlOption.setWsdl(path);
        }
    }
}