All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.itemis.maven.plugins.unleash.util.functions.DependencyToCoordinates Maven / Gradle / Ivy

Go to download

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.

There is a newer version: 2.10.0
Show newest version
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());
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy