com.itemis.maven.plugins.unleash.util.functions.DependencyToCoordinates Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of unleash-maven-plugin Show documentation
Show all versions of unleash-maven-plugin Show documentation
This plugin provides a generic alternative to the error-prone default release plugin provided by Maven. It is designed to require a minimal effort of work for releasing modules and being extensible to integrate in every project setup.
package com.itemis.maven.plugins.unleash.util.functions;
import org.apache.maven.model.Dependency;
import com.google.common.base.Function;
import com.itemis.maven.aether.ArtifactCoordinates;
/**
* A function to convert a {@link Dependency} to appropriate {@link ArtifactCoordinates}.
*
* @author Stanley Hillner
* @since 1.3.0
*/
public enum DependencyToCoordinates implements Function {
INSTANCE(true), NO_CLASSIFIER(false);
private boolean includeClassifier;
private DependencyToCoordinates(boolean includeClassifier) {
this.includeClassifier = includeClassifier;
}
@Override
public ArtifactCoordinates apply(Dependency d) {
if (this.includeClassifier) {
return new ArtifactCoordinates(d.getGroupId(), d.getArtifactId(), d.getVersion(), d.getType(), d.getClassifier());
}
return new ArtifactCoordinates(d.getGroupId(), d.getArtifactId(), d.getVersion(), d.getType());
}
}