Package org.apache.maven.plugin

Examples of org.apache.maven.plugin.MojoFailureException


            {
                return;
            }
            if ( junitArtifact != null && !junit47Compatible )
            {
                throw new MojoFailureException( "groups/excludedGroups are specified but JUnit version on classpath"
                                                    + " is too old to support groups. Check your dependency:tree to see if your project is picking up an old junit version" );
            }
            throw new MojoFailureException(
                "groups/excludedGroups require TestNG or JUnit48+ on project test classpath" );

        }
    }
View Full Code Here


            {
                if ( ( reportParameters.getFailIfNoTests() == null ) || !reportParameters.getFailIfNoTests() )
                {
                    return;
                }
                throw new MojoFailureException(
                    "No tests were executed!  (Set -DfailIfNoTests=false to ignore this error.)" );
            }

            if ( result.isErrorFree() )
            {
                return;
            }
        }

        String msg = timeoutOrOtherFailure
            ? "There was a timeout or other error in the fork"
            : "There are test failures.\n\nPlease refer to " + reportParameters.getReportsDirectory()
                + " for the individual test results.";

        if ( reportParameters.isTestFailureIgnore() )
        {
            log.error( msg );
        }
        else
        {
            if ( result.isFailure() )
            {
                throw new MojoExecutionException( msg );
            }
            else
            {
                throw new MojoFailureException( msg );
            }
        }
    }
View Full Code Here

           
            processDir(warSourceDirectory, webappDirectory, null, null, false);
            afterProcess();
            getLog().info(String.format("nb warnings: %d, nb errors: %d", jsErrorReporter_.getWarningCnt(), jsErrorReporter_.getErrorCnt()));
            if (failOnWarning && (jsErrorReporter_.getWarningCnt() > 0)) {
                throw new MojoFailureException("warnings on "+ this.getClass().getSimpleName() + "=> failure ! (see log)");
            }
        } catch (RuntimeException exc) {
            throw exc;
        } catch (MojoFailureException exc) {
            throw exc;
View Full Code Here

    protected void processDir(File srcRoot, File destRoot, List<String> srcIncludes, List<String> srcExcludes, boolean destAsSource) throws Exception {
        if ((srcRoot == null) || ( !srcRoot.exists() )) {
            return;
        }
        if (destRoot == null) {
            throw new MojoFailureException("destination directory for " + srcRoot + " is null");
        }
        DirectoryScanner scanner = new DirectoryScanner();
        scanner.setBasedir(srcRoot);
        if ( (srcIncludes != null) && !srcIncludes.isEmpty() ) {
            scanner.setIncludes( srcIncludes.toArray( EMPTY_STRING_ARRAY ) );
View Full Code Here

                    getLog().debug( "PMD failureCount: " + failureCount + ", warningCount: " + warningCount );

                    if ( failureCount > 0 && isFailOnViolation() )
                    {
                        throw new MojoFailureException( message );
                    }

                    this.getLog().info( message );
                }
                catch ( final IOException e )
                {
                    throw new MojoExecutionException( "Unable to read PMD results xml: " + outputFile.getAbsolutePath(),
                                                      e );
                }
                catch ( final XmlPullParserException e )
                {
                    throw new MojoExecutionException( "Unable to read PMD results xml: " + outputFile.getAbsolutePath(),
                                                      e );
                }
                finally
                {
                    IOUtil.close( reader );
                }
            }
            else
            {
                throw new MojoFailureException( "Unable to perform check, " + "unable to find " + outputFile );
            }
        }
    }
View Full Code Here

    private Class<?> load(final ClassLoader loader, final String name) throws MojoFailureException {
        try {
            return loader.loadClass(name);
        } catch (ClassNotFoundException e) {
            throw new MojoFailureException("can't load " + name, e);
        }
    }
View Full Code Here

            getLog().error(e);
        }
       
        if (m_totalErrors > 0 || m_totalFailures > 0) {
            if (! testFailureIgnore) {
            throw new MojoFailureException("There are test failures. \n\n"
                    + "Please refer to " + m_reportsDirectory.getAbsolutePath()
                    + " for the individual test results.");
            } else {
                getLog().warn("There are test failures. \n\n"
                    + "Please refer to " + m_reportsDirectory.getAbsolutePath()
View Full Code Here

        }
       
        if (count == 500) {
            getLog().error("Bundle stability isn't reached after 500 tries");
            dumpBundles(context);
            throw new MojoFailureException("Cannot reach the bundle stability");
        }
       
        boolean serviceStability = false;
        count = 0;
        int count1 = 0;
        int count2 = 0;
        while (! serviceStability && count < 500) {
            try {
                ServiceReference[] refs = context.getServiceReferences(null, null);
                count1 = refs.length;
                Thread.sleep(500);
                refs = context.getServiceReferences(null, null);
                count2 = refs.length;
                serviceStability = count1 == count2;
            } catch (Exception e) {
                getLog().error(e);
                serviceStability = false;
                // Nothing to do, while recheck the condition
            }
            count++;
        }
       
        if (count == 500) {
            getLog().error("Service stability isn't reached after 500 tries (" + count1 + " != " + count2);
            dumpBundles(context);
            throw new MojoFailureException("Cannot reach the service stability");
        }
       
    }
View Full Code Here

                url = Thread.currentThread().getContextClassLoader().getResource(name);
            }
        }

        if (url == null) {
            throw new MojoFailureException("Could not resolve resource: " + name);
        }

        log.debug("Resolved resource '" + name + "' as: " + url);

        return url;
View Full Code Here

    public void execute()
    throws MojoFailureException
    {
        if ( !reach( true ) || !reach( false ) )
        {
            throw new MojoFailureException( this, "Resource reachability test failed..", "Failed to reach resource: " + resource + " using one or more methods." );
        }
    }
View Full Code Here

TOP

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

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.