Java Code Examples for org.apache.maven.model.Activation#setProperty()

The following examples show how to use org.apache.maven.model.Activation#setProperty() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: DependencyAddedInProfileTest.java    From quarkus with Apache License 2.0 5 votes vote down vote up
@Override
protected TsArtifact modelApp() {

    final TsQuarkusExt extA_100 = new TsQuarkusExt("ext-a", "1.0.0");
    addToExpectedLib(extA_100.getRuntime());

    final TsQuarkusExt extB_100 = new TsQuarkusExt("ext-b", "1.0.0");
    install(extB_100);
    final TsArtifact extB_100_rt = extB_100.getRuntime();
    addToExpectedLib(extB_100_rt);

    final TsArtifact appJar = TsArtifact.jar("app")
            .addDependency(extA_100);

    final Profile profile = new Profile();
    profile.setId("extra");
    Activation activation = new Activation();
    ActivationProperty ap = new ActivationProperty();
    ap.setName("extra");
    activation.setProperty(ap);
    profile.setActivation(activation);
    final Dependency dep = new Dependency();
    dep.setGroupId(extB_100_rt.getGroupId());
    dep.setArtifactId(extB_100_rt.getArtifactId());
    dep.setVersion(extB_100_rt.getVersion());
    profile.addDependency(dep);
    appJar.addProfile(profile);

    createWorkspace();

    setSystemProperty("extra", "extra");

    return appJar;
}
 
Example 2
Source File: CreateMavenBundlePom.java    From tesb-studio-se with Apache License 2.0 5 votes vote down vote up
/**
 * skip depoly phase in publich to cloud in parent pom, enable in nexus.
 */
private Profile addProfileForCloud() {
    Profile deployCloudProfile = new Profile();
    deployCloudProfile.setId("deploy-cloud");
    Activation deployCloudActivation = new Activation();
    ActivationProperty activationProperty = new ActivationProperty();
    activationProperty.setName("!altDeploymentRepository");
    deployCloudActivation.setProperty(activationProperty);
    deployCloudProfile.setActivation(deployCloudActivation);
    deployCloudProfile.setBuild(new Build());
    deployCloudProfile.getBuild().addPlugin(addSkipDeployFeatureMavenPlugin());
    return deployCloudProfile;
}
 
Example 3
Source File: CreateMavenDataServicePom.java    From tesb-studio-se with Apache License 2.0 5 votes vote down vote up
/**
 * DOC skip depoly phase in publich to cloud in parent pom, enable in nexus.
 */
private Profile addProfileForCloud() {
    Profile deployCloudProfile = new Profile();
    deployCloudProfile.setId("deploy-cloud");
    Activation deployCloudActivation = new Activation();
    ActivationProperty activationProperty = new ActivationProperty();
    activationProperty.setName("!altDeploymentRepository");
    deployCloudActivation.setProperty(activationProperty);
    deployCloudProfile.setActivation(deployCloudActivation);
    deployCloudProfile.setBuild(new Build());
    deployCloudProfile.getBuild().addPlugin(addSkipDeployFeatureMavenPlugin());
    return deployCloudProfile;
}
 
Example 4
Source File: Project.java    From pom-manipulation-ext with Apache License 2.0 4 votes vote down vote up
public void updateProfiles (List<Profile> remoteProfiles)
{
    final List<Profile> profiles = model.getProfiles();

    if ( !remoteProfiles.isEmpty() )
    {
        for ( Profile profile : remoteProfiles )
        {
            final Iterator<Profile> i = profiles.iterator();
            while ( i.hasNext() )
            {
                final Profile p = i.next();

                if ( profile.getId().equals( p.getId() ) )
                {
                    logger.debug( "Removing local profile {} ", p );
                    i.remove();
                    // Don't break out of the loop so we can check for active profiles
                }

                // If we have injected profiles and one of the current profiles is using
                // activeByDefault it will get mistakenly deactivated due to the semantics
                // of activeByDefault. Therefore replace the activation.
                if ( p.getActivation() != null && p.getActivation().isActiveByDefault() )
                {
                    logger.warn( "Profile {} is activeByDefault", p );

                    final Activation replacement = new Activation();
                    final ActivationProperty replacementProp = new ActivationProperty();
                    replacementProp.setName( "!disableProfileActivation" );
                    replacement.setProperty( replacementProp );

                    p.setActivation( replacement );
                }
            }

            logger.debug( "Adding profile {}", profile );
            profiles.add( profile );
        }
    }
}