Example usage for org.apache.maven.model.profile.activation PropertyProfileActivator PropertyProfileActivator

List of usage examples for org.apache.maven.model.profile.activation PropertyProfileActivator PropertyProfileActivator

Introduction

In this page you can find the example usage for org.apache.maven.model.profile.activation PropertyProfileActivator PropertyProfileActivator.

Prototype

PropertyProfileActivator

Source Link

Usage

From source file:com.coutemeier.maven.jsr223.profileactivator.JSR223ProfileActivator.java

License:Open Source License

@Override
public boolean isActive(Profile profile, ProfileActivationContext context,
        ModelProblemCollector problemCollector) {
    Activation activation = profile.getActivation();

    if (activation != null) {
        ActivationProperty property = activation.getProperty();

        if (property != null) {
            String name = property.getName();
            if (name != null && name.startsWith("=")) {
                return evaluateExpression(profile, context, problemCollector);
            }/*w  ww  . j a  v a2 s .co  m*/
        }
    }

    // Call original implementation if JSR223 expression was not found
    return new PropertyProfileActivator().isActive(profile, context, problemCollector);
}

From source file:com.redhat.jboss.maven.elprofile.ElProfileActivator.java

License:Apache License

public boolean isActive(Profile profile, ProfileActivationContext context,
        ModelProblemCollector problemCollector) {

    Activation activation = profile.getActivation();

    boolean result = false;

    if (activation != null) {
        ActivationProperty property = activation.getProperty();

        if (property != null) {
            String name = property.getName();

            if (name != null && MVEL_SCRIPT_PROPERTY_NAME.equals(name)) {
                String value = property.getValue();
                logger.debug("Evaluating following MVEL expression: " + value);
                result = evaluateMvel(value, context, problemCollector);
                logger.debug("Evaluated MVEL expression: " + value + " as " + result);
            }//from  w  w w .  j a  v a  2s  .c  om
        }
    }

    // call original implementation if mvel script was not valid/false
    return result ? true : new PropertyProfileActivator().isActive(profile, context, problemCollector);
}

From source file:org.jboss.shrinkwrap.resolver.impl.maven.internal.SettingsXmlProfileSelector.java

License:Apache License

public SettingsXmlProfileSelector() {
    this.activators = new ArrayList<ProfileActivator>();
    activators.addAll(Arrays.asList(new JdkVersionProfileActivator(), new PropertyProfileActivator(),
            new OperatingSystemProfileActivator(),
            new FileProfileActivator().setPathTranslator(new DefaultPathTranslator())));
}

From source file:org.springframework.boot.cli.compiler.maven.MavenSettings.java

License:Apache License

private DefaultProfileSelector createProfileSelector() {
    DefaultProfileSelector selector = new DefaultProfileSelector();
    selector.addProfileActivator(new FileProfileActivator());
    selector.addProfileActivator(new JdkVersionProfileActivator());
    selector.addProfileActivator(new PropertyProfileActivator());
    selector.addProfileActivator(new OperatingSystemProfileActivator());
    return selector;
}

From source file:org.springframework.boot.loader.thin.MavenSettings.java

License:Apache License

private DefaultProfileSelector createProfileSelector() {
    DefaultProfileSelector selector = new DefaultProfileSelector();

    selector.addProfileActivator(new FileProfileActivator().setPathTranslator(new DefaultPathTranslator()));
    selector.addProfileActivator(new JdkVersionProfileActivator());
    selector.addProfileActivator(new PropertyProfileActivator());
    selector.addProfileActivator(new OperatingSystemProfileActivator());
    return selector;
}