
uk.co.automatictester.wiremock.maven.plugin.mojo.ConfigurationMojo Maven / Gradle / Ivy
The newest version!
package uk.co.automatictester.wiremock.maven.plugin.mojo;
import org.apache.maven.plugin.AbstractMojo;
import org.apache.maven.plugin.descriptor.PluginDescriptor;
import org.apache.maven.plugins.annotations.Parameter;
import uk.co.automatictester.wiremock.maven.plugin.util.ParameterUtil;
import java.io.File;
import java.util.List;
abstract class ConfigurationMojo extends AbstractMojo {
@Parameter(defaultValue = "${plugin}", required = true, readonly = true)
PluginDescriptor descriptor;
@Parameter(property = "project.testClasspathElements", required = true, readonly = true)
List classpathElements;
/**
* Set the root directory (--root-dir), under which mappings and __files reside.
* This defaults to: target/classes
*/
@Parameter(property = "wiremock.dir", defaultValue = "target/classes")
private File dir;
/**
* Set all other parameters in command-line format, e.g.:
* --port=8081 --verbose
* Do NOT specify --root-dir here.
*/
@Parameter(property = "wiremock.params")
private String params;
/**
* Set to true if (and only if) you want to keep the plugin running indefinitely.
*/
@Parameter(property = "wiremock.keepRunning", defaultValue = "false")
private String keepRunning;
/**
* Set to true to skip plugin execution.
*/
@Parameter(property = "wiremock.skip", defaultValue = "false")
private String skip;
boolean shouldKeepRunning() {
return keepRunning.equals("true");
}
boolean shouldSkip() {
return skip.equals("true");
}
String[] getAllParams() {
String directory = dir.toString();
if (params == null) {
return ParameterUtil.getDirParam(directory);
} else {
return ParameterUtil.getAllParams(directory, params);
}
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy