private MavenProject getMavenProject()

in src/main/java/org/apache/maven/plugin/doap/DoapMojo.java [442:478]


    private MavenProject getMavenProject(DoapArtifact artifact) {
        if (artifact == null) {
            return null;
        }

        if (StringUtils.isEmpty(artifact.getGroupId())
                || StringUtils.isEmpty(artifact.getArtifactId())
                || StringUtils.isEmpty(artifact.getVersion())) {
            getLog().warn("Missing groupId or artifactId or version in <artifact/> parameter, ignored it.");
            return null;
        }

        getLog().info("Using artifact " + artifact.getGroupId() + ":" + artifact.getArtifactId() + ":"
                + artifact.getVersion());

        try {
            Artifact art = factory.createProjectArtifact(
                    artifact.getGroupId(), artifact.getArtifactId(), artifact.getVersion(), Artifact.SCOPE_COMPILE);

            if (art.getFile() == null) {
                MavenProject proj = mavenProjectBuilder.buildFromRepository(art, remoteRepositories, localRepository);
                art = proj.getArtifact();

                resolver.resolve(art, remoteRepositories, localRepository);

                return proj;
            }
        } catch (ArtifactResolutionException e) {
            getLog().error("ArtifactResolutionException: " + e.getMessage() + "\nIgnored <artifact/> parameter.");
        } catch (ArtifactNotFoundException e) {
            getLog().error("ArtifactNotFoundException: " + e.getMessage() + "\nIgnored <artifact/> parameter.");
        } catch (ProjectBuildingException e) {
            getLog().error("ProjectBuildingException: " + e.getMessage() + "\nIgnored <artifact/> parameter.");
        }

        return null;
    }