Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Introduce a more useful ExternalMavenRunner constructor #618

Merged
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 @@ -82,7 +82,7 @@ public class PluginCompatTester {

public PluginCompatTester(PluginCompatTesterConfig config) {
this.config = config;
runner = new ExternalMavenRunner(config.getExternalMaven(), config.getMavenSettings(), config.getMavenArgs());
runner = new ExternalMavenRunner(config);
}

@SuppressFBWarnings(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
import org.jenkins.tools.test.maven.ExpressionEvaluator;
import org.jenkins.tools.test.maven.ExternalMavenRunner;
import org.jenkins.tools.test.maven.MavenRunner;
import org.jenkins.tools.test.model.PluginCompatTesterConfig;
import org.jenkins.tools.test.model.hook.BeforeExecutionContext;
import org.jenkins.tools.test.model.hook.PluginCompatTesterHookBeforeExecution;

Expand All @@ -27,9 +26,7 @@ public abstract class PropertyVersionHook extends PluginCompatTesterHookBeforeEx

@Override
public boolean check(@NonNull BeforeExecutionContext context) {
PluginCompatTesterConfig config = context.getConfig();
MavenRunner runner =
new ExternalMavenRunner(config.getExternalMaven(), config.getMavenSettings(), config.getMavenArgs());
MavenRunner runner = new ExternalMavenRunner(context.getConfig());
ExpressionEvaluator expressionEvaluator = new ExpressionEvaluator(
context.getCloneDirectory(), context.getPlugin().getModule(), runner);
try {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
import java.util.logging.Logger;
import org.apache.commons.lang.SystemUtils;
import org.jenkins.tools.test.exception.PomExecutionException;
import org.jenkins.tools.test.model.PluginCompatTesterConfig;

/** Runs external Maven executable. */
public class ExternalMavenRunner implements MavenRunner {
Expand Down Expand Up @@ -52,6 +53,13 @@ public ExternalMavenRunner(
this.mavenArgs = mavenArgs;
}

/**
* @param config The PCT configuration to extract maven arguments from.
*/
public ExternalMavenRunner(@NonNull PluginCompatTesterConfig config) {
this(config.getExternalMaven(), config.getMavenSettings(), config.getMavenArgs());
}

@Override
@SuppressFBWarnings(value = "COMMAND_INJECTION", justification = "intended behavior")
public void run(
Expand Down