All Downloads are FREE. Search and download functionalities are using the official Maven repository.
Please wait. This can take some minutes ...
Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance.
Project price only 1 $
You can buy this project and download/modify it how often you want.
com.atlassian.bamboo.specs.builders.task.MavenTask Maven / Gradle / Ivy
package com.atlassian.bamboo.specs.builders.task;
import com.atlassian.bamboo.specs.api.builders.task.Task;
import com.atlassian.bamboo.specs.model.task.MavenTaskProperties;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import java.util.Objects;
/**
* Maven 2/3 build task builder.
*/
public class MavenTask extends Task {
public enum TestDirectoryOption {
STANDARD, CUSTOM
}
public static final int MAVEN_V2 = 2;
public static final int MAVEN_V3 = 3;
@NotNull
protected String goal;
@Nullable
protected String projectFile;
@Nullable
protected String environmentVariables;
@Nullable
protected String jdk;
@Nullable
protected String label;
protected boolean hasTests;
@Nullable
protected TestDirectoryOption testDirectoryOption;
@Nullable
protected String testResultsDirectory;
@Nullable
protected String workingSubdirectory;
protected boolean useMavenReturnCode;
protected int version = MAVEN_V3;
public MavenTask goal(@NotNull String goal) {
this.goal = goal;
return this;
}
public MavenTask projectFile(String projectFile) {
this.projectFile = projectFile;
return this;
}
public MavenTask environmentVariables(String environmentVariables) {
this.environmentVariables = environmentVariables;
return this;
}
public MavenTask jdk(String jdk) {
this.jdk = jdk;
return this;
}
public MavenTask executableLabel(String label) {
this.label = label;
return this;
}
public MavenTask hasTests(boolean hasTests) {
this.hasTests = hasTests;
return this;
}
public MavenTask standardResultsPath() {
this.testDirectoryOption = TestDirectoryOption.STANDARD;
return this;
}
public MavenTask testResultsPath(String testResultsDirectory) {
this.testDirectoryOption = TestDirectoryOption.CUSTOM;
this.testResultsDirectory = testResultsDirectory;
return this;
}
public MavenTask workingSubdirectory(String workingSubdirectory) {
this.workingSubdirectory = workingSubdirectory;
return this;
}
public MavenTask useMavenReturnCode(boolean useMavenReturnCode) {
this.useMavenReturnCode = useMavenReturnCode;
return this;
}
public MavenTask version2() {
this.version = MAVEN_V2;
return this;
}
public MavenTask version3() {
this.version = MAVEN_V3;
return this;
}
@NotNull
@Override
protected MavenTaskProperties build() {
return new MavenTaskProperties(description,
taskEnabled,
goal,
projectFile,
environmentVariables,
jdk,
label,
hasTests,
testDirectoryOption,
testResultsDirectory,
workingSubdirectory,
useMavenReturnCode,
version,
requirements,
conditions);
}
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (!(o instanceof MavenTask)) {
return false;
}
if (!super.equals(o)) {
return false;
}
MavenTask mavenTask = (MavenTask) o;
return hasTests == mavenTask.hasTests &&
useMavenReturnCode == mavenTask.useMavenReturnCode &&
version == mavenTask.version &&
goal.equals(mavenTask.goal) &&
Objects.equals(projectFile, mavenTask.projectFile) &&
Objects.equals(environmentVariables, mavenTask.environmentVariables) &&
Objects.equals(jdk, mavenTask.jdk) &&
Objects.equals(label, mavenTask.label) &&
testDirectoryOption == mavenTask.testDirectoryOption &&
Objects.equals(testResultsDirectory, mavenTask.testResultsDirectory) &&
Objects.equals(workingSubdirectory, mavenTask.workingSubdirectory);
}
@Override
public int hashCode() {
return Objects.hash(super.hashCode(), goal, projectFile, environmentVariables, jdk, label, hasTests, testDirectoryOption, testResultsDirectory, workingSubdirectory, useMavenReturnCode, version);
}
}