Package org.apache.maven.reporting

Examples of org.apache.maven.reporting.MavenReportException


            {
                renderer = (Renderer) Class.forName( format ).newInstance();
            }
            catch ( Exception e )
            {
                throw new MavenReportException(
                    "Can't find CPD custom format " + format + ": " + e.getClass().getName(), e );
            }
        }

        return renderer;
View Full Code Here


                getLog().debug( "Preparing ruleset: " + set );
                File ruleset = locator.getResourceAsFile( set, getLocationTemp( set ) );

                if ( null == ruleset )
                {
                    throw new MavenReportException( "Could not resolve " + set );
                }

                InputStream rulesInput = new FileInputStream( ruleset );
                try
                {
                    RuleSet ruleSet = ruleSetFactory.createRuleSet( rulesInput );
                    sets[idx] = ruleSet;

                    ruleSet.start( ruleContext );
                }
                finally
                {
                    rulesInput.close();
                }
            }
        }
        catch ( IOException e )
        {
            throw new MavenReportException( e.getMessage(), e );
        }
        catch ( ResourceNotFoundException e )
        {
            throw new MavenReportException( e.getMessage(), e );
        }
        catch ( FileResourceCreationException e )
        {
            throw new MavenReportException( e.getMessage(), e );
        }

        Map<File, PmdFileInfo> files;
        try
        {
            files = getFilesToProcess();
        }
        catch ( IOException e )
        {
            throw new MavenReportException( "Can't get file list", e );
        }

        if ( StringUtils.isEmpty( getSourceEncoding() ) && !files.isEmpty() )
        {
            getLog().warn( "File encoding has not been set, using platform encoding " + ReaderFactory.FILE_ENCODING
                               + ", i.e. build is platform dependent!" );
        }

        for ( Map.Entry<File, PmdFileInfo> entry : files.entrySet() )
        {
            File file = entry.getKey();
            PmdFileInfo fileInfo = entry.getValue();

            // TODO: lazily call beginFile in case there are no rules

            reportSink.beginFile( file, fileInfo );
            ruleContext.setSourceCodeFilename( file.getAbsolutePath() );
            for ( int idx = 0; idx < rulesets.length; idx++ )
            {
                try
                {
                    // PMD closes this Reader even though it did not open it so we have
                    // to open a new one with every call to processFile().
                    Reader reader;
                    if ( StringUtils.isNotEmpty( getSourceEncoding() ) )
                    {
                        reader = ReaderFactory.newReader( file, getSourceEncoding() );
                    }
                    else
                    {
                        reader = ReaderFactory.newPlatformReader( file );
                    }

                    try
                    {
                        pmd.processFile( reader, sets[idx], ruleContext );
                    }
                    finally
                    {
                        reader.close();
                    }
                }
                catch ( UnsupportedEncodingException e1 )
                {
                    throw new MavenReportException( "Encoding '" + getSourceEncoding() + "' is not supported.", e1 );
                }
                catch ( PMDException pe )
                {
                    String msg = pe.getLocalizedMessage();
                    Throwable r = pe.getCause();
View Full Code Here

            siteDir.mkdirs();
            FileUtils.copyFile( targetFile, new File( siteDir, "pmd." + format ) );
        }
        catch ( IOException ioe )
        {
            throw new MavenReportException( ioe.getMessage(), ioe );
        }
        finally
        {
            IOUtil.close( writer );
        }
View Full Code Here

        if ( null != targetJdk )
        {
            SourceType sourceType = SourceType.getSourceTypeForId( "java " + targetJdk );
            if ( sourceType == null )
            {
                throw new MavenReportException( "Unsupported targetJdk value '" + targetJdk + "'." );
            }
            pmd.setJavaVersion( sourceType );
        }

        return pmd;
View Full Code Here

            {
                renderer = (Renderer) Class.forName( format ).newInstance();
            }
            catch ( Exception e )
            {
                throw new MavenReportException(
                    "Can't find PMD custom format " + format + ": " + e.getClass().getName(), e );
            }
        }

        return renderer;
View Full Code Here

                kitchenSink.rawText(indexHtmlContent);
            } else {
                writeIndexHtmlFile(outputDirectory, "index.html", indexHtmlContent);
            }
        } catch (Exception e) {
            final MavenReportException ex = new MavenReportException(e.getMessage());
            ex.initCause(e.getCause());
            throw ex;
        }
    }
View Full Code Here

            }

        }
        catch ( CheckstyleException e )
        {
            throw new MavenReportException( "Failed during checkstyle configuration", e );
        }
        catch ( CheckstyleExecutorException e )
        {
            throw new MavenReportException( "Failed during checkstyle execution", e );
        }
        finally
        {
            //be sure to restore original context classloader
            Thread.currentThread().setContextClassLoader( currentClassLoader );
View Full Code Here

                listener = new DefaultLogger( out, true );
            }
            else
            {
                // TODO: failure if not a report
                throw new MavenReportException( "Invalid output file format: (" + outputFileFormat
                    + "). Must be 'plain' or 'xml'." );
            }
        }

        return listener;
View Full Code Here

        {
            fileOutputStream = new FileOutputStream( file );
        }
        catch ( FileNotFoundException e )
        {
            throw new MavenReportException( "Unable to create output stream: " + file, e );
        }
        return fileOutputStream;
    }
View Full Code Here

        {
            rresource.copy( "images/rss.png" );
        }
        catch ( IOException e )
        {
            throw new MavenReportException( "Unable to copy static resources.", e );
        }
    }
View Full Code Here

TOP

Related Classes of org.apache.maven.reporting.MavenReportException

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.