Example usage for org.apache.maven.repository.metadata ArtifactMetadata setType

List of usage examples for org.apache.maven.repository.metadata ArtifactMetadata setType

Introduction

In this page you can find the example usage for org.apache.maven.repository.metadata ArtifactMetadata setType.

Prototype

public void setType(String type) 

Source Link

Usage

From source file:org.ebayopensource.turmeric.eclipse.mavenapi.impl.MavenEclipseApi.java

License:Open Source License

/**
 * {@inheritDoc}/* w w  w. ja v a2s . c o m*/
 */
@Override
public MavenProject resolveArtifactAsProject(final Artifact artifact) throws MavenEclipseApiException {
    if (artifact == null)
        return null;
    final IMavenProjectFacade facade = getMavenProjectManager().getMavenProject(artifact.getGroupId(),
            artifact.getArtifactId(), artifact.getVersion());

    try {
        if (facade != null)
            return facade.getMavenProject(new NullProgressMonitor());
        resolveArtifact(artifact);
        final File pomFile = MavenEclipseUtil.getArtifactPOMFile(artifact);
        if (pomFile.exists() == false) {
            final ArtifactMetadata pomArtifact = MavenEclipseUtil.artifactMetadata(artifact);
            pomArtifact.setType(PACKAGING_TYPE_POM);
            resolveArtifact(pomArtifact);
        }

        return _getEmbedder().readProject(pomFile, new NullProgressMonitor());
    } catch (CoreException e) {
        throw new MavenEclipseApiException(e);
    }
}