Package org.apache.maven.plugin

Examples of org.apache.maven.plugin.MojoExecutionException


        try
        {
            final File howtoCartridgePicturesSourceFile = new File(this.howtoCartridgePicturesSourcePath);
            if (!howtoCartridgePicturesSourceFile.exists())
            {
                throw new MojoExecutionException("Cartridge howto pictures source location is invalid");
            }
           
            this.unpack(
                    howtoCartridgePicturesSourceFile,
                    new File(this.howtoCartridgePicturesOutputDirectory));
        }
        catch (final Throwable throwable)
        {
            if (throwable instanceof MojoExecutionException)
            {
                throw (MojoExecutionException)throwable;
            }
            throw new MojoExecutionException("An error occured unpacking cartridge howto pictures '" +
                this.project.getArtifactId() + "'",
                ExceptionUtils.getRootCause(throwable));
        }
    }
View Full Code Here


        {
            if (throwable instanceof MojoExecutionException)
            {
                throw (MojoExecutionException)throwable;
            }
            throw new MojoExecutionException(
                    "An error occured while running AndroMDA over the cartridge howto model '" +
                    this.project.getArtifactId() + "'", ExceptionUtils.getRootCause(throwable));
        }
    }
View Full Code Here

                processor.setUseTraceTranslator(this.traceExpression);
                processor.setTestSourceDirectory(this.testSourceDirectory);
                final URL configurationUri = ResourceUtils.toURL(this.configurationUri);
                if (configurationUri == null)
                {
                    throw new MojoExecutionException("No configuration could be loaded from --> '" +
                        this.configurationUri + "'");
                }
                processor.setConfiguration(this.getConfiguration(configurationUri));

                final TranslationLibraryTestFormatter formatter = new TranslationLibraryTestFormatter();

                // - set the report location
                final File report = new File(this.reportDirectory, this.getProject().getArtifactId() + ".txt");
                formatter.setReportFile(report);
                final TestResult result = new TestResult();
                formatter.startTestSuite(this.getProject().getName());
                result.addListener(formatter);
                processor.setResult(result);
                processor.runSuite();
                this.getLog().info("");
                this.getLog().info("Results:");
                this.getLog().info(formatter.endTestSuite());
                if (result.failureCount() > 0 || result.errorCount() > 0)
                {
                    throw new MojoExecutionException("Test are some test failures");
                }
                processor.shutdown();
            }
            catch (final Throwable throwable)
            {
                if (throwable instanceof MojoExecutionException)
                {
                    throw (MojoExecutionException)throwable;
                }
                throw new MojoExecutionException("An error occured while testing translation-library",
                    ExceptionUtils.getRootCause(throwable));
            }
        }
        else
        {
View Full Code Here

                this.project,
                this.archive);
        }
        catch (final Throwable throwable)
        {
            throw new MojoExecutionException("Error assembling distribution", throwable);
        }
    }
View Full Code Here

                            this.project.getRemoteArtifactRepositories(),
                            this.localRepository);
                }
                catch (final Throwable throwable)
                {
                    throw new MojoExecutionException("Project could not be built from pom file " + pom, exception);
                }
            }
        }
        if (this.getLog().isDebugEnabled())
        {
View Full Code Here

            this.getLog().info("Copying " + sourceFile.getAbsolutePath() + " to " + destFile.getAbsolutePath());
            FileUtils.copyFile(sourceFile, destFile);
        }
        catch (Exception e)
        {
            throw new MojoExecutionException("Error copying file from " + sourceFile + " to " + destFile, e);
        }
    }
View Full Code Here

            unArchiver.setDestDirectory(location);
            unArchiver.extract();
        }
        catch (NoSuchArchiverException e)
        {
            throw new MojoExecutionException("Unknown archiver type", e);
        }
        catch (IOException e)
        {
            e.printStackTrace();
            throw new MojoExecutionException("Error unpacking file: " +
                    file.getAbsolutePath() + " to: " + location + "\r\n" + e.toString(), e);
        }
        catch (ArchiverException e)
        {
            e.printStackTrace();
            throw new MojoExecutionException("Error unpacking file: " +
                    file + " to: " + location + "\r\n" + e.toString(), e);
        }
    }
View Full Code Here

                    }
                }
            }
            catch (final Throwable throwable)
            {
                throw new MojoExecutionException("Error installing bootstrap artifact(s)", throwable);
            }
        }
    }
View Full Code Here

            if (tasks != null && !tasks.isEmpty())
            {
                final Map tasksMap = (Map)SchemaMojo.tasksCache.get(this.taskType);
                if (tasksMap == null)
                {
                    throw new MojoExecutionException("'" + taskType +
                        "' is not a valid task type, valid task types are: " + tasksMap.keySet());
                }

                this.properties.putAll(this.project.getProperties());
                for (final Iterator iterator = this.getTasks().iterator(); iterator.hasNext();)
                {
                    final String task = ObjectUtils.toString(iterator.next()).trim();
                    if (this.propertyFiles != null)
                    {
                        final int numberOfPropertyFiles = propertyFiles.length;
                        for (int ctr2 = 0; ctr2 < numberOfPropertyFiles; ctr2++)
                        {
                            final URL propertyFileUri = ResourceUtils.toURL(propertyFiles[ctr2]);
                            if (propertyFileUri != null)
                            {
                                final InputStream stream = propertyFileUri.openStream();
                                this.properties.load(stream);
                                stream.close();
                            }
                        }
                    }

                    // - load all the fields of this class into the properties
                    final Field[] fields = this.getClass().getDeclaredFields();
                    if (fields != null)
                    {
                        final int numberOfFields = fields.length;
                        for (int ctr = 0; ctr < numberOfFields; ctr++)
                        {
                            final Field field = fields[ctr];
                            final Object value = field.get(this);
                            if (value != null)
                            {
                                this.properties.put(
                                    field.getName(),
                                    value);
                            }
                        }
                    }

                    final Set classpathElements = new LinkedHashSet(this.project.getRuntimeClasspathElements());
                    classpathElements.addAll(this.getProvidedClasspathElements());
                    this.initializeClasspathFromClassPathElements(classpathElements);
                    final Class type = (Class)tasksMap.get(task);
                    if (type == null)
                    {
                        throw new MojoExecutionException("'" + task + "' is not a valid task, valid types are: " +
                            tasksMap.keySet());
                    }

                    final SchemaManagement schemaManagement = (SchemaManagement)ClassUtils.newInstance(type);
                    connection = executeScripts ? this.getConnection() : null;
                    this.executeSql(
                        connection,
                        schemaManagement.execute(
                            connection,
                            this.properties));
                }
            }

            // - execute any additional scripts
            this.executeScripts(connection);
        }
        catch (final Throwable throwable)
        {
            throw new MojoExecutionException("An error occured while attempting to create the schema", throwable);
        }
        finally
        {
            if (connection != null)
            {
View Full Code Here

                        connection,
                        location);
                }
                catch (final Exception exception)
                {
                    throw new MojoExecutionException("Execution failed on script: " + location, exception);
                }
            }
        }
        else if (tasks == null || tasks.isEmpty())
        {
View Full Code Here

TOP

Related Classes of org.apache.maven.plugin.MojoExecutionException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.