Skip to content

Commit

Permalink
Avoid NPE's. Project list at the end of the cmd
Browse files Browse the repository at this point in the history
  • Loading branch information
ivanjensen-ep committed Feb 14, 2022
1 parent ee0fc5d commit 86689e2
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 20 deletions.
24 changes: 13 additions & 11 deletions src/main/java/com/elasticpath/tools/mavenminimal/MvnMinCli.java
Original file line number Diff line number Diff line change
Expand Up @@ -295,17 +295,19 @@ private static int executeMavenOnReactors(final ExtendedReactor xreactor, final
printer.newline(); // add some spacing

// Skip the reactors before the one containing the resume-from module, let the rest run.
boolean resumeFromActivated = false;
for (Reactor subReactor : xreactor.getSubReactors()) {
if (!resumeFromActivated) {
for (String activeModule : subReactor.getActiveModules()) { // can't simply do `contains()`
Logger.debug(activeModule);
if (activeModule.contains(resumeFromModule)) { // look for the abbreviated module name
resumeFromActivated = true;
} else {
Logger.debug("Skipping " + subReactor.getReactorName()
+ " looking for resume-from module: " + resumeFromModule);
subReactor.setSkipReactor(true);
if (resumeFromModule != null) {
boolean resumeFromActivated = false;
for (Reactor subReactor : xreactor.getSubReactors()) {
if (!resumeFromActivated) {
for (String activeModule : subReactor.getActiveModules()) { // can't simply do `contains()`
Logger.debug(activeModule);
if (activeModule.contains(resumeFromModule)) { // look for the abbreviated module name
resumeFromActivated = true;
} else {
Logger.debug("Skipping " + subReactor.getReactorName()
+ " looking for resume-from module: " + resumeFromModule);
subReactor.setSkipReactor(true);
}
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -133,20 +133,22 @@ private static CommandLine determineMavenCommand(
mavenArguments.add("-T1");
}

// Skip the reactors before the one containing the resume-from module, let the rest run.
if (resumeFromModule != null) {
for (String activeModule : reactor.getActiveModules()) { // can't simply do `contains()`
if (activeModule.contains(resumeFromModule)) { // look for the abbreviated module name
mavenArguments.add("-rf");
mavenArguments.add(resumeFromModule);
break;
}
}
}

if (reactor.hasActiveModules()) {
mavenArguments.add("--projects");
mavenArguments.add(String.join(",", reactor.getActiveModules()));
}

// Skip the reactors before the one containing the resume-from module, let the rest run.
for (String activeModule : reactor.getActiveModules()) { // can't simply do `contains()`
if (activeModule.contains(resumeFromModule)) { // look for the abbreviated module name
mavenArguments.add("-rf");
mavenArguments.add(resumeFromModule);
break;
}
}

String mvnCommand = determineMvnExecutable(overrideMvnCommand);

CommandLine cmdLine = new CommandLine(mvnCommand);
Expand Down

0 comments on commit 86689e2

Please sign in to comment.