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

com.itemis.maven.plugins.unleash.util.predicates.IsSnapshotDependency 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: 3.2.0
Show newest version
package com.itemis.maven.plugins.unleash.util.predicates;

import org.apache.maven.model.Dependency;

import com.google.common.base.Predicate;
import com.itemis.maven.plugins.unleash.util.MavenVersionUtil;
import com.itemis.maven.plugins.unleash.util.PomPropertyResolver;

/**
 * A predicate determining whether a {@link Dependency} has a SNAPSHOT version assigned.
 *
 * @author Stanley Hillner
 * @since 1.0.0
 */
public class IsSnapshotDependency implements Predicate {
  private PomPropertyResolver propertyResolver;

  public IsSnapshotDependency(PomPropertyResolver propertyResolver) {
    this.propertyResolver = propertyResolver;
  }

  @Override
  public boolean apply(Dependency d) {
    String version = d.getVersion();
    version = propertyResolver.expandPropertyReferences(version);
    return version != null && MavenVersionUtil.isSnapshot(version);
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy