当前位置: 首页>>代码示例>>Java>>正文


Java ModelProblemCollector类代码示例

本文整理汇总了Java中org.apache.maven.model.building.ModelProblemCollector的典型用法代码示例。如果您正苦于以下问题:Java ModelProblemCollector类的具体用法?Java ModelProblemCollector怎么用?Java ModelProblemCollector使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


ModelProblemCollector类属于org.apache.maven.model.building包,在下文中一共展示了ModelProblemCollector类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: injectLifecycleBindings

import org.apache.maven.model.building.ModelProblemCollector; //导入依赖的package包/类
public void injectLifecycleBindings( Model model, ModelBuildingRequest request, ModelProblemCollector problems )
{
    String packaging = model.getPackaging();

    Collection<Plugin> defaultPlugins = lifecycle.getPluginsBoundByDefaultToAllLifecycles( packaging );

    if ( defaultPlugins == null )
    {
        problems.add( new ModelProblemCollectorRequest( Severity.ERROR, Version.BASE)
                .setMessage( "Unknown packaging: " + packaging )
                .setLocation( model.getLocation( "packaging" )));
    }
    else if ( !defaultPlugins.isEmpty() )
    {
        Model lifecycleModel = new Model();
        lifecycleModel.setBuild( new Build() );
        lifecycleModel.getBuild().getPlugins().addAll( defaultPlugins );

        merger.merge( model, lifecycleModel );
    }
}
 
开发者ID:gems-uff,项目名称:oceano,代码行数:22,代码来源:DefaultLifecycleBindingsInjector.java

示例2: validate20EffectivePluginDependencies

import org.apache.maven.model.building.ModelProblemCollector; //导入依赖的package包/类
private void validate20EffectivePluginDependencies( ModelProblemCollector problems, Plugin plugin,
                                                  ModelBuildingRequest request )
{
    List<Dependency> dependencies = plugin.getDependencies();

    if ( !dependencies.isEmpty() )
    {
        String prefix = "build.plugins.plugin[" + plugin.getKey() + "].dependencies.dependency.";

        Severity errOn30 = getSeverity( request, ModelBuildingRequest.VALIDATION_LEVEL_MAVEN_3_0 );

        for ( Dependency d : dependencies )
        {
            validateEffectiveDependency( problems, d, false, prefix, request );

            validateVersion( prefix + "version", problems, errOn30, Version.BASE, d.getVersion(), d.getManagementKey(), d );

            validateEnum( prefix + "scope", problems, errOn30, Version.BASE, d.getScope(), d.getManagementKey(), d, "compile",
                          "runtime", "system" );
        }
    }
}
 
开发者ID:gems-uff,项目名称:oceano,代码行数:23,代码来源:DefaultModelValidator.java

示例3: validate20EffectiveRepository

import org.apache.maven.model.building.ModelProblemCollector; //导入依赖的package包/类
private void validate20EffectiveRepository( ModelProblemCollector problems, Repository repository, String prefix,
                                 ModelBuildingRequest request )
{
    if ( repository != null )
    {
        Severity errOn31 = getSeverity( request, ModelBuildingRequest.VALIDATION_LEVEL_MAVEN_3_1 );

        validateBannedCharacters( prefix + ".id", problems, errOn31, Version.V20, repository.getId(), null, repository,
                                  ILLEGAL_REPO_ID_CHARS );

        if ( "local".equals( repository.getId() ) )
        {
            addViolation( problems, errOn31, Version.V20, prefix + ".id", null, "must not be 'local'"
                + ", this identifier is reserved for the local repository"
                + ", using it for other repositories will corrupt your repository metadata.", repository );
        }

        if ( "legacy".equals( repository.getLayout() ) )
        {
            addViolation( problems, Severity.WARNING, Version.V20, prefix + ".layout", repository.getId(),
                          "uses the unsupported value 'legacy', artifact resolution might fail.", repository );
        }
    }
}
 
开发者ID:gems-uff,项目名称:oceano,代码行数:25,代码来源:DefaultModelValidator.java

示例4: validateId

import org.apache.maven.model.building.ModelProblemCollector; //导入依赖的package包/类
private boolean validateId( String fieldName, ModelProblemCollector problems, Severity severity, Version version, String id,
                            String sourceHint, InputLocationTracker tracker )
{
    if ( !validateStringNotEmpty( fieldName, problems, severity, version, id, sourceHint, tracker ) )
    {
        return false;
    }
    else
    {
        boolean match = ID_REGEX.matcher( id ).matches();
        if ( !match )
        {
            addViolation( problems, severity, version, fieldName, sourceHint, "with value '" + id
                + "' does not match a valid id pattern.", tracker );
        }
        return match;
    }
}
 
开发者ID:gems-uff,项目名称:oceano,代码行数:19,代码来源:DefaultModelValidator.java

示例5: validateStringNotEmpty

import org.apache.maven.model.building.ModelProblemCollector; //导入依赖的package包/类
/**
 * Asserts:
 * <p/>
 * <ul>
 * <li><code>string != null</code>
 * <li><code>string.length > 0</code>
 * </ul>
 */
private boolean validateStringNotEmpty( String fieldName, ModelProblemCollector problems, Severity severity, Version version, 
                                        String string, String sourceHint, InputLocationTracker tracker )
{
    if ( !validateNotNull( fieldName, problems, severity, version, string, sourceHint, tracker ) )
    {
        return false;
    }

    if ( string.length() > 0 )
    {
        return true;
    }

    addViolation( problems, severity, version, fieldName, sourceHint, "is missing.", tracker );

    return false;
}
 
开发者ID:gems-uff,项目名称:oceano,代码行数:26,代码来源:DefaultModelValidator.java

示例6: validateBoolean

import org.apache.maven.model.building.ModelProblemCollector; //导入依赖的package包/类
private boolean validateBoolean( String fieldName, ModelProblemCollector problems, Severity severity, Version version,
                                 String string, String sourceHint, InputLocationTracker tracker )
{
    if ( string == null || string.length() <= 0 )
    {
        return true;
    }

    if ( "true".equalsIgnoreCase( string ) || "false".equalsIgnoreCase( string ) )
    {
        return true;
    }

    addViolation( problems, severity, version, fieldName, sourceHint, "must be 'true' or 'false' but is '" + string + "'.",
                  tracker );

    return false;
}
 
开发者ID:gems-uff,项目名称:oceano,代码行数:19,代码来源:DefaultModelValidator.java

示例7: validateEnum

import org.apache.maven.model.building.ModelProblemCollector; //导入依赖的package包/类
private boolean validateEnum( String fieldName, ModelProblemCollector problems, Severity severity, Version version, String string,
                              String sourceHint, InputLocationTracker tracker, String... validValues )
{
    if ( string == null || string.length() <= 0 )
    {
        return true;
    }

    List<String> values = Arrays.asList( validValues );

    if ( values.contains( string ) )
    {
        return true;
    }

    addViolation( problems, severity, version, fieldName, sourceHint, "must be one of " + values + " but is '" + string
        + "'.", tracker );

    return false;
}
 
开发者ID:gems-uff,项目名称:oceano,代码行数:21,代码来源:DefaultModelValidator.java

示例8: validateBannedCharacters

import org.apache.maven.model.building.ModelProblemCollector; //导入依赖的package包/类
private boolean validateBannedCharacters( String fieldName, ModelProblemCollector problems, Severity severity, Version version, 
                                          String string, String sourceHint, InputLocationTracker tracker,
                                          String banned )
{
    if ( string != null )
    {
        for ( int i = string.length() - 1; i >= 0; i-- )
        {
            if ( banned.indexOf( string.charAt( i ) ) >= 0 )
            {
                addViolation( problems, severity, version, fieldName, sourceHint,
                              "must not contain any of these characters " + banned + " but found "
                                  + string.charAt( i ), tracker );
                return false;
            }
        }
    }

    return true;
}
 
开发者ID:gems-uff,项目名称:oceano,代码行数:21,代码来源:DefaultModelValidator.java

示例9: validateVersion

import org.apache.maven.model.building.ModelProblemCollector; //导入依赖的package包/类
private boolean validateVersion( String fieldName, ModelProblemCollector problems, Severity severity, Version version,
                                 String string, String sourceHint, InputLocationTracker tracker )
{
    if ( string == null || string.length() <= 0 )
    {
        return true;
    }

    if ( hasExpression( string ) )
    {
        addViolation( problems, severity, version, fieldName, sourceHint,
                      "must be a valid version but is '" + string + "'.", tracker );
        return false;
    }

    if ( !validateBannedCharacters( fieldName, problems, severity, version, string, sourceHint, tracker,
                                    ILLEGAL_VERSION_CHARS ) )
    {
        return false;
    }

    return true;
}
 
开发者ID:gems-uff,项目名称:oceano,代码行数:24,代码来源:DefaultModelValidator.java

示例10: validate20ProperSnapshotVersion

import org.apache.maven.model.building.ModelProblemCollector; //导入依赖的package包/类
private boolean validate20ProperSnapshotVersion( String fieldName, ModelProblemCollector problems, Severity severity, Version version,
                                               String string, String sourceHint, InputLocationTracker tracker )
{
    if ( string == null || string.length() <= 0 )
    {
        return true;
    }

    if ( string.endsWith( "SNAPSHOT" ) && !string.endsWith( "-SNAPSHOT" ) )
    {
        addViolation( problems, severity, version, fieldName, sourceHint, "uses an unsupported snapshot version format"
            + ", should be '*-SNAPSHOT' instead.", tracker );
        return false;
    }

    return true;
}
 
开发者ID:gems-uff,项目名称:oceano,代码行数:18,代码来源:DefaultModelValidator.java

示例11: validate20PluginVersion

import org.apache.maven.model.building.ModelProblemCollector; //导入依赖的package包/类
private boolean validate20PluginVersion( String fieldName, ModelProblemCollector problems, String string,
                                       String sourceHint, InputLocationTracker tracker,
                                       ModelBuildingRequest request )
{
    if ( string == null )
    {
        // NOTE: The check for missing plugin versions is handled directly by the model builder
        return true;
    }

    Severity errOn30 = getSeverity( request, ModelBuildingRequest.VALIDATION_LEVEL_MAVEN_3_0 );

    if ( !validateVersion( fieldName, problems, errOn30, Version.V20, string, sourceHint, tracker ) )
    {
        return false;
    }

    if ( string.length() <= 0 || "RELEASE".equals( string ) || "LATEST".equals( string ) )
    {
        addViolation( problems, errOn30, Version.V20, fieldName, sourceHint, "must be a valid version but is '" + string + "'.",
                      tracker );
        return false;
    }

    return true;
}
 
开发者ID:gems-uff,项目名称:oceano,代码行数:27,代码来源:DefaultModelValidator.java

示例12: expandPluginConfiguration

import org.apache.maven.model.building.ModelProblemCollector; //导入依赖的package包/类
public void expandPluginConfiguration( Model model, ModelBuildingRequest request, ModelProblemCollector problems )
{
    Reporting reporting = model.getReporting();

    if ( reporting != null )
    {
        for ( ReportPlugin reportPlugin : reporting.getPlugins() )
        {
            Xpp3Dom parentDom = (Xpp3Dom) reportPlugin.getConfiguration();

            if ( parentDom != null )
            {
                for ( ReportSet execution : reportPlugin.getReportSets() )
                {
                    Xpp3Dom childDom = (Xpp3Dom) execution.getConfiguration();
                    childDom = Xpp3Dom.mergeXpp3Dom( childDom, new Xpp3Dom( parentDom ) );
                    execution.setConfiguration( childDom );
                }
            }
        }
    }
}
 
开发者ID:gems-uff,项目名称:oceano,代码行数:23,代码来源:DefaultReportConfigurationExpander.java

示例13: expandPluginConfiguration

import org.apache.maven.model.building.ModelProblemCollector; //导入依赖的package包/类
public void expandPluginConfiguration( Model model, ModelBuildingRequest request, ModelProblemCollector problems )
{
    Build build = model.getBuild();

    if ( build != null )
    {
        expand( build.getPlugins() );

        PluginManagement pluginManagement = build.getPluginManagement();

        if ( pluginManagement != null )
        {
            expand( pluginManagement.getPlugins() );
        }
    }
}
 
开发者ID:gems-uff,项目名称:oceano,代码行数:17,代码来源:DefaultPluginConfigurationExpander.java

示例14: injectProfile

import org.apache.maven.model.building.ModelProblemCollector; //导入依赖的package包/类
public void injectProfile( Model model, Profile profile, ModelBuildingRequest request,
                           ModelProblemCollector problems )
{
    if ( profile != null )
    {
        merger.mergeModelBase( model, profile );

        if ( profile.getBuild() != null )
        {
            if ( model.getBuild() == null )
            {
                model.setBuild( new Build() );
            }
            merger.mergeBuildBase( model.getBuild(), profile.getBuild() );
        }
    }
}
 
开发者ID:gems-uff,项目名称:oceano,代码行数:18,代码来源:DefaultProfileInjector.java

示例15: isActive

import org.apache.maven.model.building.ModelProblemCollector; //导入依赖的package包/类
private boolean isActive( Profile profile, ProfileActivationContext context, ModelProblemCollector problems )
{
    for ( ProfileActivator activator : activators )
    {
        try
        {
            if ( activator.isActive( profile, context, problems ) )
            {
                return true;
            }
        }
        catch ( RuntimeException e )
        {
            problems.add( new ModelProblemCollectorRequest( Severity.ERROR, Version.BASE)
                    .setMessage( "Failed to determine activation for profile " + profile.getId())
                    .setLocation( profile.getLocation( "" ))
                    .setException( e ));
            return false;
        }
    }
    return false;
}
 
开发者ID:gems-uff,项目名称:oceano,代码行数:23,代码来源:DefaultProfileSelector.java


注:本文中的org.apache.maven.model.building.ModelProblemCollector类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。