Example usage for org.apache.maven.artifact DefaultArtifact setOptional

List of usage examples for org.apache.maven.artifact DefaultArtifact setOptional

Introduction

In this page you can find the example usage for org.apache.maven.artifact DefaultArtifact setOptional.

Prototype

public void setOptional(boolean optional) 

Source Link

Usage

From source file:com.puresoltechnologies.maven.plugins.license.internal.DependencyUtilities.java

/**
 * This method builds a new {@link Artifact} from a {@link Dependency}.
 * //w  w w .  j  a  va2  s.co m
 * @param parentArtifact
 *            is a parent Artifact which is used to get an
 *            {@link ArtifactHandler} from.
 * @param dependency
 *            is the {@link Dependency} object whose information is to be
 *            used to build a new artifact.
 * @return An {@link Artifact} is returned build from the {@link Dependency}
 *         parameter.
 */
public static Artifact buildArtifact(Artifact parentArtifact, Dependency dependency) {
    DefaultArtifact dependencyArtifact = new DefaultArtifact(dependency.getGroupId(),
            dependency.getArtifactId(), dependency.getVersion(), dependency.getScope(), dependency.getType(),
            dependency.getClassifier(), parentArtifact.getArtifactHandler());
    dependencyArtifact.setOptional(dependency.isOptional());
    return dependencyArtifact;
}

From source file:org.fluidity.deployment.maven.DependenciesSupportImpl.java

License:Apache License

@Override
public Artifact dependencyArtifact(final Dependency dependency) {
    final DefaultArtifact artifact = new DefaultArtifact(dependency.getGroupId(), dependency.getArtifactId(),
            dependency.getVersion(), dependency.getScope(), dependency.getType(), dependency.getClassifier(),
            new DefaultArtifactHandler(dependency.getType()));
    artifact.setOptional(Boolean.valueOf(dependency.getOptional()));
    return artifact;
}