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

com.itemis.maven.plugins.unleash.util.functions.ProjectToCoordinates 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.project.MavenProject;

import com.google.common.base.Function;
import com.itemis.maven.aether.ArtifactCoordinates;
import com.itemis.maven.plugins.unleash.util.PomUtil;

/**
 * A function to convert a {@link Project} to a {@link ArtifactCoordinates} object.
* There are several implementations that include different properties of the pom and may set defaults. * * @author Stanley Hillner * @since 1.0.0 */ public enum ProjectToCoordinates implements Function { /** * Uses all relevant properties of the project. */ INSTANCE(true, null), /** * Assumes the default empty version for the project. */ EMPTY_VERSION(false, null), /** * Uses the relevant properties of the project but assumes "pom" packaging. */ POM(true, PomUtil.ARTIFACT_TYPE_POM), /** * Assumes an empty project version and packaging type "pom". */ EMPTY_VERSION_POM(false, PomUtil.ARTIFACT_TYPE_POM); private boolean includeVersion; private String type; private ProjectToCoordinates(boolean version, String type) { this.includeVersion = version; this.type = type; } @Override public ArtifactCoordinates apply(MavenProject p) { if (this.includeVersion) { return new ArtifactCoordinates(p.getGroupId(), p.getArtifactId(), p.getVersion(), this.type != null ? this.type : p.getPackaging()); } else { return new ArtifactCoordinates(p.getGroupId(), p.getArtifactId(), MavenProject.EMPTY_PROJECT_VERSION, this.type != null ? this.type : p.getPackaging()); } } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy