com.github.danielflower.mavenplugins.release.ReleasableModule Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of multi-module-maven-release-plugin Show documentation
Show all versions of multi-module-maven-release-plugin Show documentation
A maven release plugin built for multi-maven-module git repositories allowing continuous deployment
package com.github.danielflower.mavenplugins.release;
import org.apache.maven.project.MavenProject;
import java.util.List;
public class ReleasableModule {
private final MavenProject project;
private final VersionName version;
private final String tagName;
private final String equivalentVersion;
private final String relativePathToModule;
public ReleasableModule(MavenProject project, VersionName version, String equivalentVersion, String relativePathToModule) {
this.project = project;
this.version = version;
this.equivalentVersion = equivalentVersion;
this.relativePathToModule = relativePathToModule;
this.tagName = project.getArtifactId() + "-" + version.releaseVersion();
}
public String getTagName() {
return tagName;
}
public String getNewVersion() {
return version.releaseVersion();
}
public String getArtifactId() {
return project.getArtifactId();
}
public String getGroupId() {
return project.getGroupId();
}
public MavenProject getProject() {
return project;
}
public String getVersion() {
return version.businessVersion();
}
public long getBuildNumber() {
return version.buildNumber();
}
public boolean isOneOf(List moduleNames) {
String modulePath = project.getBasedir().getName();
for (String moduleName : moduleNames) {
if (modulePath.equals(moduleName)) {
return true;
}
}
return false;
}
public boolean willBeReleased() {
return equivalentVersion == null;
}
public String getVersionToDependOn() {
return willBeReleased() ? version.releaseVersion() : equivalentVersion;
}
public String getRelativePathToModule() {
return relativePathToModule;
}
public ReleasableModule createReleasableVersion() {
return new ReleasableModule(project, version, null, relativePathToModule);
}
}