本文整理匯總了Java中org.apache.maven.plugin.MojoFailureException類的典型用法代碼示例。如果您正苦於以下問題:Java MojoFailureException類的具體用法?Java MojoFailureException怎麽用?Java MojoFailureException使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
MojoFailureException類屬於org.apache.maven.plugin包,在下文中一共展示了MojoFailureException類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: execute
import org.apache.maven.plugin.MojoFailureException; //導入依賴的package包/類
@Override
public void execute() throws MojoExecutionException, MojoFailureException {
extractTemplatesFromJar();
try {
PublishProvider provider;
switch (publish.getProvider()) {
default:
provider = new ConfluenceProvider(publish.getEndpoint(), publish.getUsername(), publish.getPassword());
}
List<Page> pages = readHtmlPages();
publish(provider, pages);
} catch (Exception e) {
throw new MojoExecutionException("Unexpected error", e);
}
}
示例2: execute
import org.apache.maven.plugin.MojoFailureException; //導入依賴的package包/類
@Override
public void execute() throws MojoExecutionException, MojoFailureException {
initializeHandlers();
for (AppBuildHandler appBuildHandler : appBuildHandlers) {
appBuildHandler.handle();
}
final Build build = project.getBuild();
final List<String> nonFilteredFileExtensions = getNonFilteredFileExtensions(build.getPlugins());
MavenResourcesExecution mavenResourcesExecution =
new MavenResourcesExecution(build.getResources(), new File(outputDirectory), project,
ENCODING, build.getFilters(), nonFilteredFileExtensions, session);
try {
mavenResourcesFiltering.filterResources(mavenResourcesExecution);
} catch (MavenFilteringException e) {
throw new WMRuntimeException("Failed to execute resource filtering ", e);
}
}
示例3: initializeHandlers
import org.apache.maven.plugin.MojoFailureException; //導入依賴的package包/類
private void initializeHandlers() throws MojoFailureException {
if (appBuildHandlers == null) {
appBuildHandlers = new ArrayList<AppBuildHandler>();
Folder rootFolder = new LocalFolder(baseDirectory);
Folder pagesFolder = rootFolder.getFolder(pagesDirectory);
if (pagesFolder.exists()) {
appBuildHandlers.add(new PageMinFileGenerationHandler(pagesFolder));
}
Folder servicesFolder = rootFolder.getFolder(servicesDirectory);
if (servicesFolder.exists()) {
URL[] runtimeClasspathElements = getRuntimeClasspathElements();
appBuildHandlers.add(new SwaggerDocGenerationHandler(servicesFolder, runtimeClasspathElements));
appBuildHandlers.add(new VariableServiceDefGenerationHandler(rootFolder));
}
}
}
示例4: getRuntimeClasspathElements
import org.apache.maven.plugin.MojoFailureException; //導入依賴的package包/類
private URL[] getRuntimeClasspathElements() throws MojoFailureException {
URL[] runtimeUrls = null;
try {
List<String> compileClasspathElements = project.getCompileClasspathElements();
List<String> runtimeClasspathElements = project.getRuntimeClasspathElements();
Set<String> allClassPathElements = new LinkedHashSet<>(compileClasspathElements.size());
allClassPathElements.addAll(compileClasspathElements);
allClassPathElements.addAll(runtimeClasspathElements);
runtimeUrls = new URL[allClassPathElements.size()];
int index=0;
for (String s: allClassPathElements ) {
runtimeUrls[index++] = new File(s).toURI().toURL();
}
} catch (Exception exception) {
throw new MojoFailureException("Failed resolve project dependencies", exception);
}
return runtimeUrls;
}
示例5: execute
import org.apache.maven.plugin.MojoFailureException; //導入依賴的package包/類
@Override
public void execute() throws MojoExecutionException, MojoFailureException
{
logger.info("package name {}",packageName);
logger.info("suites name {}",suites);
try
{
generateReport(packageName, suites);
}
catch (IOException e)
{
getLog().error("sorry, report cannot created");
}
}
示例6: execute
import org.apache.maven.plugin.MojoFailureException; //導入依賴的package包/類
@Override
public void execute() throws MojoExecutionException, MojoFailureException {
try {
final Resource resource = new Resource();
resource.setDirectory(outputDir.getCanonicalPath());
project.addResource(resource);
final Set<File> generated = new HashSet<>();
final ReadApiClientData reader = new ReadApiClientData();
final List<ModelData<?>> modelList = reader.readDataFromFile("io/syndesis/dao/deployment.json");
for (final ModelData<?> model : modelList) {
if (model.getKind() == Kind.Connector) {
final Connector connector = (Connector) model.getData();
for (final ConnectorAction action : connector.getActions()) {
process(generated, connector, action, action.getInputDataShape());
process(generated, connector, action, action.getOutputDataShape());
}
}
}
} catch (final IOException e) {
throw new MojoFailureException(e.getMessage(), e);
}
}
示例7: execute
import org.apache.maven.plugin.MojoFailureException; //導入依賴的package包/類
@Override
public void execute() throws MojoExecutionException, MojoFailureException {
try {
outputDirectory.mkdirs();
if (Files.exists(outputDirectory.toPath().resolve(".git"))) {
throw new MojoExecutionException("Cannot execute mojo in a directory that already contains a .git directory");
}
executeCommand(outputDirectory, "git", "init");
executeCommand(outputDirectory, "git", "remote", "add", "origin", repository);
executeCommand(outputDirectory, "git", "config", "core.sparseCheckout", "true");
Path sparseCheckoutFile = outputDirectory.toPath().resolve(".git/info/sparse-checkout");
Files.write(sparseCheckoutFile, paths);
executeCommand(outputDirectory, "git", "pull", "origin", branch);
executeCommand(outputDirectory, "rm", "-rf", ".git");
getLog().info("Files were checked out in: " + outputDirectory);
} catch (IOException e) {
throw new MojoFailureException("Caught IOException in mojo", e);
}
}
示例8: prepareRequiredParameters
import org.apache.maven.plugin.MojoFailureException; //導入依賴的package包/類
protected Map<String, String> prepareRequiredParameters(final FunctionTemplate template)
throws MojoFailureException {
info("");
info(PREPARE_PARAMS);
prepareFunctionName();
preparePackageName();
final Map<String, String> params = new HashMap<>();
params.put("functionName", getFunctionName());
params.put("className", getClassName());
params.put("packageName", getFunctionPackageName());
prepareTemplateParameters(template, params);
displayParameters(params);
return params;
}
示例9: prepareFunctionName
import org.apache.maven.plugin.MojoFailureException; //導入依賴的package包/類
protected void prepareFunctionName() throws MojoFailureException {
info("Common parameter [Function Name]: name for both the new function and Java class");
if (settings != null && !settings.isInteractiveMode()) {
assureInputInBatchMode(getFunctionName(),
str -> isNotEmpty(str) && str.matches(FUNCTION_NAME_REGEXP),
this::setFunctionName,
true);
} else {
assureInputFromUser("Enter value for Function Name: ",
getFunctionName(),
str -> isNotEmpty(str) && str.matches(FUNCTION_NAME_REGEXP),
"Function name must start with a letter and can contain letters, digits, '_' and '-'",
this::setFunctionName);
}
}
示例10: preparePackageName
import org.apache.maven.plugin.MojoFailureException; //導入依賴的package包/類
protected void preparePackageName() throws MojoFailureException {
info("Common parameter [Package Name]: package name of the new Java class");
if (settings != null && !settings.isInteractiveMode()) {
assureInputInBatchMode(getFunctionPackageName(),
str -> isNotEmpty(str) && isName(str),
this::setFunctionPackageName,
true);
} else {
assureInputFromUser("Enter value for Package Name: ",
getFunctionPackageName(),
str -> isNotEmpty(str) && isName(str),
"Input should be a valid Java package name.",
this::setFunctionPackageName);
}
}
示例11: assureInputInBatchMode
import org.apache.maven.plugin.MojoFailureException; //導入依賴的package包/類
protected void assureInputInBatchMode(final String input, final Function<String, Boolean> validator,
final Consumer<String> setter, final boolean required)
throws MojoFailureException {
if (validator.apply(input)) {
info(FOUND_VALID_VALUE);
setter.accept(input);
return;
}
if (required) {
throw new MojoFailureException(String.format("invalid input: %s", input));
} else {
out.printf("The input is invalid. Use empty string.%n");
setter.accept("");
}
}
示例12: executeInternal
import org.apache.maven.plugin.MojoFailureException; //導入依賴的package包/類
@Override
public void executeInternal() throws MojoExecutionException, MojoFailureException {
PullPolicy policy = null;
if (imagePullPolicy == null) {
policy = PullPolicy.ALWAYS;
} else {
switch (imagePullPolicy) {
case "always":
policy = PullPolicy.ALWAYS;
break;
case "ifNotPresent":
policy = PullPolicy.IF_LOCAL_IMAGE_ABSENT;
break;
case "ifNewer":
policy = PullPolicy.IF_REGISTRY_IMAGE_NEWER;
break;
default:
throw new MojoExecutionException("Unknown image pull policy : " + imagePullPolicy);
}
}
getLog().info("Pulling images with policy : " + imagePullPolicy);
getRuntime().pull(policy);
}
示例13: execute
import org.apache.maven.plugin.MojoFailureException; //導入依賴的package包/類
public static void execute(ContainerOrchestrationRuntime runtime, Carnotzet carnotzet, Log log)
throws MojoExecutionException, MojoFailureException {
try {
IpPlaceholderResolver ipPlaceholderResolver = new IpPlaceholderResolver(runtime);
WelcomePageGenerator generator = new WelcomePageGenerator(Arrays.asList(ipPlaceholderResolver));
Path moduleResources = carnotzet.getResourcesFolder().resolve("expanded-jars");
Path welcomePagePath = carnotzet.getResourcesFolder().resolve("welcome.html");
generator.buildWelcomeHtmlFile(moduleResources, welcomePagePath);
new ProcessBuilder("xdg-open", "file://" + welcomePagePath).start();
log.info("********************************************************");
log.info("* *");
log.info("* The WELCOME page was opened in your default browser *");
log.info("* *");
log.info("********************************************************");
}
catch (IOException e) {
throw new MojoExecutionException("Cannot start browser:" + e, e);
}
}
示例14: execute
import org.apache.maven.plugin.MojoFailureException; //導入依賴的package包/類
public static void execute(ContainerOrchestrationRuntime runtime, Carnotzet carnotzet, String service) throws MojoExecutionException,
MojoFailureException {
if (service == null) {
runtime.start();
} else {
runtime.start(service);
}
Runtime.getRuntime().addShutdownHook(new Thread(() -> {
if (service == null) {
if (runtime.isRunning()) {
runtime.stop();
}
} else {
if (runtime.getContainer(service).isRunning()) {
runtime.stop(service);
}
}
}));
LogListener printer = new StdOutLogPrinter(Utils.getServiceNames(carnotzet), null, true);
if (service != null) {
printer.setEventFilter(event -> event.getService().equals(service));
}
runtime.registerLogListener(printer);
Utils.waitForUserInterrupt();
}
示例15: execute
import org.apache.maven.plugin.MojoFailureException; //導入依賴的package包/類
@Override
public void execute() throws MojoExecutionException, MojoFailureException {
SourceGen generator = new SourceGen(sourceDir, outputDir);
try {
Map<String, OutputType> result = generator.run();
int size = result.size();
if(size > 0) {
String types = result.values().stream().map(OutputType::getName).collect(Collectors.joining(", "));
String msg = String.format("Generated %d types in %s: %s", size, outputDir.getCanonicalPath(), types);
getLog().info(msg);
} else {
getLog().info("No types generated");
}
} catch (IOException e) {
throw new MojoExecutionException("Failed to generate TypeScript source", e);
}
}