tools.bestquality.maven.ci.PropertyResolver Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of ci-maven-plugin Show documentation
Show all versions of ci-maven-plugin Show documentation
Maven plugin for building and releasing from CI pipelines
package tools.bestquality.maven.ci;
import org.apache.maven.execution.MavenSession;
import org.apache.maven.project.MavenProject;
import java.util.Properties;
import java.util.function.Supplier;
public class PropertyResolver {
private final Supplier nullSupplier = () -> null;
private final MavenProject project;
private final MavenSession session;
public PropertyResolver(MavenProject project, MavenSession session) {
this.project = project;
this.session = session;
}
public String resolve(String property, Supplier defaultValue) {
Properties systemProperties = session.getSystemProperties();
if (systemProperties.containsKey(property)) {
return systemProperties.getProperty(property);
}
Properties properties = project.getProperties();
return properties.containsKey(property)
? properties.getProperty(property)
: defaultValue.get();
}
public String resolve(String property) {
return resolve(property, nullSupplier);
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy