Package org.apache.maven.settings.validation

Examples of org.apache.maven.settings.validation.SettingsValidationResult


    private void validateSettings( Settings settings,
                                   File location )
        throws IOException
    {
        SettingsValidationResult validationResult = validator.validate( settings );

        if ( validationResult.getMessageCount() > 0 )
        {
            throw new IOException( "Failed to validate Settings file at " + location + "\n" + validationResult.render( "\n" ) );
        }
    }
View Full Code Here


        }
    }

    public SettingsValidationResult validateSettings( File settingsFile )
    {
        SettingsValidationResult result = new SettingsValidationResult();
        if ( settingsFile != null && !settingsFile.canRead() )
        {
            try
            {
                Settings settings = readSettings( settingsFile );

                return validator.validate( settings );
            }
            catch ( IOException e )
            {
                result.addMessage( e.getMessage() );
            }
            catch ( XmlPullParserException e )
            {
                result.addMessage( e.getMessage() );
            }
        }
        else
        {
            // TODO do we have anything to say?
View Full Code Here

                                                      SettingsProblem.Severity.FATAL, settingsFile.getAbsolutePath(),
                                                      -1, -1, e ) );
            return new Settings();
        }

        SettingsValidationResult result = settingsValidator.validate( settings );

        for ( String error : result.getMessages() )
        {
            problems.add( new DefaultSettingsProblem( error, SettingsProblem.Severity.ERROR,
                                                      settingsFile.getAbsolutePath(), -1, -1, null ) );
        }
View Full Code Here

TOP

Related Classes of org.apache.maven.settings.validation.SettingsValidationResult

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.