Example usage for org.apache.maven.project MavenProject MavenProject

List of usage examples for org.apache.maven.project MavenProject MavenProject

Introduction

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

Prototype

public MavenProject(MavenProject project) 

Source Link

Usage

From source file:se.jguru.nazgul.tools.codestyle.enforcer.rules.MavenTestUtils.java

License:Apache License

/**
 * Creates a MavenProject from the supplied data.
 *
 * @param packaging  The packaging for the MavenProject to return.
 * @param groupId    The groupId for the MavenProject to return.
 * @param artifactId The artifactId for the MavenProject to return.
 * @param version    The version for the MavenProject to return.
 * @return a MavenProjectStub created from the supplied properties.
 *///  w  w w .j a v  a  2s.c o m
public static MavenProject getStub(final String packaging, final String groupId, final String artifactId,
        final String version) {

    final Model model = new Model();
    model.setModelVersion("4.0.0");
    model.setGroupId(groupId);
    model.setArtifactId(artifactId);
    model.setVersion(version);
    model.setPackaging(packaging);

    // The MavenProjectStub does not query its model for GAV values ...
    final MavenProject toReturn = new MavenProject(model);
    toReturn.setGroupId(groupId);
    toReturn.setArtifactId(artifactId);
    toReturn.setPackaging(packaging);
    toReturn.setVersion(version);
    return toReturn;
}