Java 类org.apache.maven.model.building.ModelProblemCollectorRequest 实例源码

项目:oceano    文件:DefaultLifecycleBindingsInjector.java   
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 );
    }
}
项目:oceano    文件:DefaultProfileSelector.java   
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;
}
项目:oceano    文件:ProblemDetectingValueSource.java   
public Object getValue( String expression )
{
    Object value = valueSource.getValue( expression );

    if ( value != null && expression.startsWith( bannedPrefix ) )
    {
        String msg = "The expression ${" + expression + "} is deprecated.";
        if ( newPrefix != null && newPrefix.length() > 0 )
        {
            msg += " Please use ${" + newPrefix + expression.substring( bannedPrefix.length() ) + "} instead.";
        }
        problems.add( new ModelProblemCollectorRequest( Severity.WARNING, Version.V20 ).setMessage( msg ));
    }

    return value;
}
项目:https-github.com-g0t4-jenkins2-course-spring-boot    文件:MavenSettings.java   
private String createFailureMessage(
        SpringBootCliModelProblemCollector problemCollector) {
    StringWriter message = new StringWriter();
    PrintWriter printer = new PrintWriter(message);
    printer.println("Failed to determine active profiles:");
    for (ModelProblemCollectorRequest problem : problemCollector.getProblems()) {
        printer.println("    " + problem.getMessage() + (problem.getLocation() != null
                ? " at " + problem.getLocation() : ""));
        if (problem.getException() != null) {
            printer.println(indentStackTrace(problem.getException(), "        "));
        }
    }
    return message.toString();
}
项目:spring-boot-concourse    文件:MavenSettings.java   
private String createFailureMessage(
        SpringBootCliModelProblemCollector problemCollector) {
    StringWriter message = new StringWriter();
    PrintWriter printer = new PrintWriter(message);
    printer.println("Failed to determine active profiles:");
    for (ModelProblemCollectorRequest problem : problemCollector.getProblems()) {
        printer.println("    " + problem.getMessage() + (problem.getLocation() != null
                ? " at " + problem.getLocation() : ""));
        if (problem.getException() != null) {
            printer.println(indentStackTrace(problem.getException(), "        "));
        }
    }
    return message.toString();
}
项目:spring-cloud-function    文件:MavenSettings.java   
private String createFailureMessage(
        SpringBootCliModelProblemCollector problemCollector) {
    StringWriter message = new StringWriter();
    PrintWriter printer = new PrintWriter(message);
    printer.println("Failed to determine active profiles:");
    for (ModelProblemCollectorRequest problem : problemCollector.getProblems()) {
        printer.println("    " + problem.getMessage() + (problem.getLocation() != null
                ? " at " + problem.getLocation() : ""));
        if (problem.getException() != null) {
            printer.println(indentStackTrace(problem.getException(), "        "));
        }
    }
    return message.toString();
}
项目:contestparser    文件:MavenSettings.java   
private String createFailureMessage(
        SpringBootCliModelProblemCollector problemCollector) {
    StringWriter message = new StringWriter();
    PrintWriter printer = new PrintWriter(message);
    printer.println("Failed to determine active profiles:");
    for (ModelProblemCollectorRequest problem : problemCollector.getProblems()) {
        printer.println(
                "    " + problem.getMessage() + " at " + problem.getLocation());
    }
    return message.toString();
}
项目:oceano    文件:DefaultModelValidator.java   
public void add( ModelProblemCollectorRequest req )
{
    if ( !ModelProblem.Severity.WARNING.equals( req.getSeverity() ) )
    {
        result.addMessage( req.getMessage() );
    }
}
项目:oceano    文件:DefaultProfileManager.java   
public List getActiveProfiles()
    throws ProfileActivationException
{
    DefaultProfileActivationContext context = new DefaultProfileActivationContext();
    context.setActiveProfileIds( activatedIds );
    context.setInactiveProfileIds( deactivatedIds );
    context.setSystemProperties( System.getProperties() );
    context.setUserProperties( requestProperties );

    final List<ProfileActivationException> errors = new ArrayList<ProfileActivationException>();

    List<Profile> profiles =
        profileSelector.getActiveProfiles( profilesById.values(), context, new ModelProblemCollector()
        {

            public void add( ModelProblemCollectorRequest req )
            {
                if ( !ModelProblem.Severity.WARNING.equals( req.getSeverity() ) )
                {
                    errors.add( new ProfileActivationException( req.getMessage(), req.getException() ) );
                }
            }
        } );

    if ( !errors.isEmpty() )
    {
        throw errors.get( 0 );
    }

    return profiles;
}
项目:oceano    文件:DefaultModelValidator.java   
private static void addViolation( ModelProblemCollector problems, Severity severity, Version version, String fieldName,
                                  String sourceHint, String message, InputLocationTracker tracker )
{
    StringBuilder buffer = new StringBuilder( 256 );
    buffer.append( '\'' ).append( fieldName ).append( '\'' );

    if ( sourceHint != null )
    {
        buffer.append( " for " ).append( sourceHint );
    }

    buffer.append( ' ' ).append( message );

    problems.add( new ModelProblemCollectorRequest( severity, version ).setMessage( buffer.toString() ).setLocation( getLocation( fieldName, tracker )));
}
项目:oceano    文件:JdkVersionProfileActivator.java   
public boolean isActive( Profile profile, ProfileActivationContext context, ModelProblemCollector problems )
{
    Activation activation = profile.getActivation();

    if ( activation == null )
    {
        return false;
    }

    String jdk = activation.getJdk();

    if ( jdk == null )
    {
        return false;
    }

    String version = context.getSystemProperties().get( "java.version" );

    if ( version == null || version.length() <= 0 )
    {
        problems.add( new ModelProblemCollectorRequest( Severity.ERROR, Version.BASE )
                .setMessage( "Failed to determine Java version for profile " + profile.getId() )
                .setLocation(activation.getLocation( "jdk" ) ) );
        return false;
    }

    if ( jdk.startsWith( "!" ) )
    {
        return !version.startsWith( jdk.substring( 1 ) );
    }
    else if ( isRange( jdk ) )
    {
        return isInRange( version, getRange( jdk ) );
    }
    else
    {
        return version.startsWith( jdk );
    }
}
项目:https-github.com-g0t4-jenkins2-course-spring-boot    文件:MavenSettings.java   
@Override
public void add(ModelProblemCollectorRequest req) {
    this.problems.add(req);
}
项目:https-github.com-g0t4-jenkins2-course-spring-boot    文件:MavenSettings.java   
List<ModelProblemCollectorRequest> getProblems() {
    return this.problems;
}
项目:spring-boot-concourse    文件:MavenSettings.java   
@Override
public void add(ModelProblemCollectorRequest req) {
    this.problems.add(req);
}
项目:spring-boot-concourse    文件:MavenSettings.java   
List<ModelProblemCollectorRequest> getProblems() {
    return this.problems;
}
项目:spring-cloud-function    文件:MavenSettings.java   
@Override
public void add(ModelProblemCollectorRequest req) {
    this.problems.add(req);
}
项目:spring-cloud-function    文件:MavenSettings.java   
List<ModelProblemCollectorRequest> getProblems() {
    return this.problems;
}
项目:contestparser    文件:MavenSettings.java   
@Override
public void add(ModelProblemCollectorRequest req) {
    this.problems.add(req);
}
项目:contestparser    文件:MavenSettings.java   
List<ModelProblemCollectorRequest> getProblems() {
    return this.problems;
}
项目:flatten-maven-plugin    文件:LoggingModelProblemCollector.java   
/**
 * {@inheritDoc}
 */
public void add( ModelProblemCollectorRequest req )
{
    this.logger.warn( req.getMessage(), req.getException() );
}