Package org.apache.maven.enforcer.rule.api

Examples of org.apache.maven.enforcer.rule.api.EnforcerRuleException


        }
    }

    protected static void checkArgument(final boolean condition, String errorMessage) throws EnforcerRuleException {
        if (!condition) {
            throw new EnforcerRuleException(errorMessage);
        }
    }
View Full Code Here


                }
            }
        }

        if (sb.length() != 0) {
            throw new EnforcerRuleException(sb.toString() +
                    (message == null ? "Please update the dependency management." : message));
        }
    }
View Full Code Here

        log.info("checking availability of port : " + this.port);

        // make sure it's > 0
        if (!(this.port > 0))
        {
            throw new EnforcerRuleException("Port is not valid " + this.port);
        }

        // check availability
        if (!available(this.port))
        {
            throw new EnforcerRuleException("Port is not available " + this.port);
        }

        if (this.shouldIfail)
        {
            throw new EnforcerRuleException("Failing because my param said so.");
        }
    }
View Full Code Here

                        AbstractVersionEnforcer.containsVersion( VersionRange.createFromVersionSpec( pattern[2] ),
                                                                 new DefaultArtifactVersion( artifact.getBaseVersion() ) );
                }
                catch ( InvalidVersionSpecificationException e )
                {
                    throw new EnforcerRuleException( "Invalid Version Range: ", e );
                }
            }
        }

        if ( result && pattern.length > 3 )
View Full Code Here

                    project = getProject( helper );
                }
                Artifact parentArtifact = project.getParentArtifact();
                if ( parentArtifact != null && parentArtifact.isSnapshot() )
                {
                    throw new EnforcerRuleException( "Parent Cannot be a snapshot: " + parentArtifact.getId() );
                }
            }
        }
    }
View Full Code Here

        {
            return (MavenProject) helper.evaluate( "${project}" );
        }
        catch ( ExpressionEvaluationException eee )
        {
            throw new EnforcerRuleException( "Unable to retrieve the MavenProject: ", eee );
        }
    }
View Full Code Here

                                                           collector );
            return node;
        }
        catch ( ExpressionEvaluationException e )
        {
            throw new EnforcerRuleException( "Unable to lookup an expression " + e.getLocalizedMessage(), e );
        }
        catch ( ComponentLookupException e )
        {
            throw new EnforcerRuleException( "Unable to lookup a component " + e.getLocalizedMessage(), e );
        }
        catch ( DependencyTreeBuilderException e )
        {
            throw new EnforcerRuleException( "Could not build dependency tree " + e.getLocalizedMessage(), e );
        }
    }
View Full Code Here

            {
                log.warn( errorMsg );
            }
            if ( errorMsgs.size() > 0 )
            {
                throw new EnforcerRuleException( "Failed while enforcing releasability the error(s) are " + errorMsgs );
            }
        }
        catch ( ComponentLookupException e )
        {
            throw new EnforcerRuleException( "Unable to lookup a component " + e.getLocalizedMessage(), e );
        }
        catch ( Exception e )
        {
            throw new EnforcerRuleException( e.getLocalizedMessage(), e );
        }
    }
View Full Code Here

        throws EnforcerRuleException
    {

        if ( !allowNulls && files.length == 0 )
      {
            throw new EnforcerRuleException( "The file list is empty and Null files are disabled." );
      }

        List<File> failures = new ArrayList<File>();
        for ( File file : files )
        {
            if ( !allowNulls && file == null )
          {
                failures.add( file );
          }
          else if ( !checkFile( file ) )
            {
                failures.add( file );
            }
        }

        // if anything was found, log it with the optional message.
        if ( !failures.isEmpty() )
        {
            StringBuilder buf = new StringBuilder();
            if ( message != null )
            {
                buf.append( message + "\n" );
            }
            buf.append( getErrorMsg() );

            for ( File file : failures )
            {
                if ( file != null )
                {
                    buf.append( file.getAbsolutePath() + "\n" );
                }
                else
                {
                    buf.append( "(an empty filename was given and allowNulls is false)\n" );
                }
            }

            throw new EnforcerRuleException( buf.toString() );
        }
    }
View Full Code Here

        if ( message != null )
        {
            buf.append( message + "\n" );
        }
        buf.append( "Always fails!" );
        throw new EnforcerRuleException( buf.toString() );
    }
View Full Code Here

TOP

Related Classes of org.apache.maven.enforcer.rule.api.EnforcerRuleException

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.