Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ public class DefaultInvocationRequest implements InvocationRequest {

private boolean ignoreTransitiveRepositories;

private List<String> args = new ArrayList<>();
private final List<String> args = new ArrayList<>();

/**
* <p>getBaseDirectory.</p>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -373,9 +373,9 @@ enum ReactorFailureBehavior {
*/
FailNever("fn", "fail-never");

private String shortOption;
private final String shortOption;

private String longOption;
private final String longOption;

ReactorFailureBehavior(String shortOption, String longOption) {
this.shortOption = shortOption;
Expand Down Expand Up @@ -423,7 +423,7 @@ enum CheckSumPolicy {
/**
* Warn checksum failures equivalent {@code --lax-checksums}.
*/
Warn;
Warn
}

// ----------------------------------------------------------------------
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -121,10 +121,10 @@ private void log(int level, String message, Throwable error) {
}

buffer.append("Error:\n");
buffer.append(writer.toString());
buffer.append(writer);
}

out.println(buffer.toString());
out.println(buffer);
}

/** {@inheritDoc} */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -164,38 +164,14 @@ void requestProvidedWorkingDirectoryShouldOverrideGlobal() throws Exception {

@Test
void shouldUseSystemOutLoggerWhenNoneSpecified() throws Exception {
setupTempMavenHomeIfMissing(false);
setupTempMavenHomeIfMissing();

mclb.checkRequiredState();
}

private File setupTempMavenHomeIfMissing(boolean forceDummy) throws Exception {
private File setupTempMavenHomeIfMissing() {
String mavenHome = System.getProperty("maven.home");

File appDir;

if (forceDummy || (mavenHome == null) || !new File(mavenHome).exists()) {
appDir = Files.createDirectories(
temporaryFolder.resolve("invoker-tests").resolve("maven-home"))
.toFile();

File binDir = new File(appDir, "bin");
binDir.mkdirs();

if (Os.isFamily(Os.FAMILY_WINDOWS)) {
createDummyFile(binDir, "mvn.bat");
} else {
createDummyFile(binDir, "mvn");
}

Properties props = System.getProperties();
props.setProperty("maven.home", appDir.getCanonicalPath());

System.setProperties(props);
} else {
appDir = new File(mavenHome);
}

File appDir = new File(mavenHome);
return appDir;
}

Expand Down Expand Up @@ -718,7 +694,7 @@ void shouldSpecifySingleGoalFromRequest() throws Exception {
}

@Test
void shouldSpecifySingleGoalFromRequestArg() throws Exception {
void shouldSpecifySingleGoalFromRequestArg() {

mclb.setArgs(newRequest().addArg("test"), cli);

Expand All @@ -739,7 +715,7 @@ void shouldSpecifyTwoGoalsFromRequest() throws Exception {
}

@Test
void shouldSpecifyTwoGoalsFromRequestArgs() throws Exception {
void shouldSpecifyTwoGoalsFromRequestArgs() {
List<String> goals = new ArrayList<>();
goals.add("test");
goals.add("clean");
Expand All @@ -759,7 +735,7 @@ void shouldSpecifyThreadsFromRequest() {

@Test
void buildTypicalMavenInvocationEndToEnd() throws Exception {
File mavenDir = setupTempMavenHomeIfMissing(false);
File mavenDir = setupTempMavenHomeIfMissing();

InvocationRequest request = newRequest();

Expand Down Expand Up @@ -812,7 +788,7 @@ void buildTypicalMavenInvocationEndToEnd() throws Exception {

@Test
void shouldInsertActivatedProfiles() throws Exception {
setupTempMavenHomeIfMissing(false);
setupTempMavenHomeIfMissing();

String profile1 = "profile-1";
String profile2 = "profile-2";
Expand Down Expand Up @@ -869,7 +845,7 @@ void defaultMavenCommand() throws Exception {

@Test
void addShellEnvironment() throws Exception {
setupTempMavenHomeIfMissing(false);
setupTempMavenHomeIfMissing();

InvocationRequest request = newRequest();

Expand Down