CtrlK
BlogDocsLog inGet started
Tessl Logo

tessl/maven-org-apache-maven--maven-model

Model for Maven POM (Project Object Model)

Pending
Overview
Eval results
Files

profiles.mddocs/

Profile System

Profile definitions, activation conditions, and profile-specific build configuration. Profiles enable conditional build behavior based on environment properties, operating system, file presence, or explicit activation.

Capabilities

Profile

Represents a build profile that can conditionally modify the build based on activation criteria.

public class Profile extends ModelBase {
    public String getId();
    public void setId(String id);
    public Activation getActivation();
    public void setActivation(Activation activation);
    public Build getBuild();
    public void setBuild(Build build);
    
    // Utility methods
    public String toString();
    public Profile clone();
    public InputLocation getLocation(Object key);
    public void setLocation(Object key, InputLocation location);
}

Usage Example:

Profile profile = new Profile();
profile.setId("development");

// Set up activation based on property
Activation activation = new Activation();
ActivationProperty property = new ActivationProperty();
property.setName("env");
property.setValue("dev");
activation.setProperty(property);
profile.setActivation(activation);

// Add profile-specific build configuration
Build build = new Build();
build.setFinalName("myapp-dev");
profile.setBuild(build);

model.addProfile(profile);

Activation

Defines the conditions under which a profile should be activated.

public class Activation {
    public boolean isActiveByDefault();
    public String getActiveByDefault();
    public void setActiveByDefault(String activeByDefault);
    public String getJdk();
    public void setJdk(String jdk);
    public ActivationOS getOs();
    public void setOs(ActivationOS os);
    public ActivationProperty getProperty();
    public void setProperty(ActivationProperty property);
    public ActivationFile getFile();
    public void setFile(ActivationFile file);
    
    // Utility methods
    public Activation clone();
    public InputLocation getLocation(Object key);
    public void setLocation(Object key, InputLocation location);
}

ActivationProperty

Activates a profile based on the presence or value of a system property.

public class ActivationProperty {
    public String getName();
    public void setName(String name);
    public String getValue();
    public void setValue(String value);
    
    // Utility methods
    public ActivationProperty clone();
    public InputLocation getLocation(Object key);
    public void setLocation(Object key, InputLocation location);
}

Property Activation Examples:

// Activate when property is present (any value)
ActivationProperty prop1 = new ActivationProperty();
prop1.setName("debug");

// Activate when property has specific value
ActivationProperty prop2 = new ActivationProperty();
prop2.setName("environment");
prop2.setValue("production");

// Activate when property is NOT present
ActivationProperty prop3 = new ActivationProperty();
prop3.setName("!skipTests");

ActivationOS

Activates a profile based on operating system characteristics.

public class ActivationOS {
    public String getName();
    public void setName(String name);
    public String getFamily();
    public void setFamily(String family);
    public String getArch();
    public void setArch(String arch);
    public String getVersion();
    public void setVersion(String version);
    
    // Utility methods
    public ActivationOS clone();
    public InputLocation getLocation(Object key);
    public void setLocation(Object key, InputLocation location);
}

Usage Example:

ActivationOS os = new ActivationOS();
os.setFamily("windows");
os.setArch("x86_64");

Activation activation = new Activation();
activation.setOs(os);

Common OS Families:

  • windows
  • unix
  • mac

ActivationFile

Activates a profile based on the presence or absence of files.

public class ActivationFile {
    public String getMissing();
    public void setMissing(String missing);
    public String getExists();
    public void setExists(String exists);
    
    // Utility methods
    public ActivationFile clone();
    public InputLocation getLocation(Object key);
    public void setLocation(Object key, InputLocation location);
}

Usage Example:

// Activate when file exists
ActivationFile file1 = new ActivationFile();
file1.setExists("src/main/config/local.properties");

// Activate when file is missing
ActivationFile file2 = new ActivationFile();
file2.setMissing("src/main/config/production.properties");

Activation activation = new Activation();
activation.setFile(file1);

Profile Activation Methods

Command Line Activation

Profiles can be activated from the command line:

# Activate specific profiles
mvn compile -P profile1,profile2

# Deactivate specific profiles
mvn compile -P !profile1

# Activate and deactivate profiles
mvn compile -P profile1,!profile2

Automatic Activation

Profiles are automatically activated when their activation conditions are met:

// Always active
Activation activation = new Activation();
activation.setActiveByDefault("true");

// JDK version based
activation.setJdk("11");        // Exact version
activation.setJdk("[1.8,)");    // Version range
activation.setJdk("!1.7");      // Exclude version

Environment-Based Activation

// Property-based activation
ActivationProperty prop = new ActivationProperty();
prop.setName("maven.test.skip");
prop.setValue("true");

// OS-based activation  
ActivationOS os = new ActivationOS();
os.setFamily("unix");

// File-based activation
ActivationFile file = new ActivationFile();
file.setExists("deployment.properties");

Install with Tessl CLI

npx tessl i tessl/maven-org-apache-maven--maven-model

docs

build-config.md

core-model.md

dependencies.md

index.md

model-merging.md

profiles.md

project-metadata.md

repositories.md

utility-classes.md

xml-io.md

tile.json