Skip to content

Commit

Permalink
Tweak so no value has to be supplied with the -j parameter when
Browse files Browse the repository at this point in the history
invoked from the command line.
  • Loading branch information
Dave Wichers committed May 1, 2024
1 parent 65b445b commit a5fdb8f
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -450,6 +450,11 @@ protected void processCommandLineArgs(String[] args) {
}
}

/**
* The execute() method is invoked when this class is invoked as a maven plugin, rather than via
* the command line. So what we do here is set up the command line parameters and then invoke
* main() so this can be called both as a plugin, or via the command line.
*/
@Override
public void execute() throws MojoExecutionException, MojoFailureException {
if (null == this.pluginFilenameParam) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -573,7 +573,6 @@ protected void processCommandLineArgs(String[] args) {
Option.builder("j")
.longOpt("json")
.desc("generate json version of verification results")
.hasArg()
.build());
options.addOption("m", "", false, "verify fixed test suite");
options.addOption(
Expand Down Expand Up @@ -616,7 +615,7 @@ protected void processCommandLineArgs(String[] args) {
formatter.printHelp("BenchmarkCrawlerVerification", options, true);
}
if (line.hasOption("j")) {
generateJSONResults = line.getOptionValue("j");
generateJSONResults = "true";
}
if (line.hasOption("n")) {
selectedTestCaseName = line.getOptionValue("n");
Expand All @@ -630,6 +629,11 @@ protected void processCommandLineArgs(String[] args) {
}
}

/**
* The execute() method is invoked when this class is invoked as a maven plugin, rather than via
* the command line. So what we do here is set up the command line parameters and then invoke
* main() so this can be called both as a plugin, or via the command line.
*/
@Override
public void execute() throws MojoExecutionException, MojoFailureException {
if (null == this.pluginFilenameParam) {
Expand All @@ -643,8 +647,8 @@ public void execute() throws MojoExecutionException, MojoFailureException {
mainArgs.add(this.pluginTestCaseNameParam);
}
if (this.generateJSONResults != null) {
// At the command line, only the -j is required, with no value needed
mainArgs.add("-j");
mainArgs.add(this.generateJSONResults);
}
main(mainArgs.stream().toArray(String[]::new));
}
Expand Down

0 comments on commit a5fdb8f

Please sign in to comment.