apache/maven · error · ProfileActivationException

The property name is required to activate the profile '{}'

Error message

The property name is required to activate the profile '{}'

What it means

Thrown when a profile declares <activation><property> without a <name> element. SystemPropertyProfileActivator requires the property name before it can look up a system property; an activation property block with a null name aborts profile evaluation with ProfileActivationException naming the profile. Value alone is not enough - Maven must know which property to read.

Source

Thrown at compat/maven-compat/src/main/java/org/apache/maven/profiles/activation/SystemPropertyProfileActivator.java:58

    }

    @Override
    protected boolean canDetectActivation(Profile profile) {
        return profile.getActivation() != null && profile.getActivation().getProperty() != null;
    }

    @Override
    public boolean isActive(Profile profile) throws ProfileActivationException {
        Activation activation = profile.getActivation();

        ActivationProperty property = activation.getProperty();

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

            if (name == null) {
                throw new ProfileActivationException(
                        "The property name is required to activate the profile '" + profile.getId() + "'");
            }

            if (name.startsWith("!")) {
                reverseName = true;
                name = name.substring(1);
            }

            String sysValue = properties.getProperty(name);

            String propValue = property.getValue();
            if (propValue != null && !propValue.isEmpty()) {
                boolean reverseValue = false;
                if (propValue.startsWith("!")) {
                    reverseValue = true;
                    propValue = propValue.substring(1);
                }

View on GitHub (pinned to e4093d4e12)

Solutions

  1. Add the missing <name> to the activation property: <property><name>env</name><value>prod</value></property>
  2. If the intent was 'activate when property X exists', specify only <name>X</name> and omit <value>
  3. If the intent was negation, use <name>!X</name>
  4. Run 'mvn help:active-profiles' to confirm the corrected profile resolves

Example fix

<!-- before -->
<activation>
  <property>
    <value>production</value>
  </property>
</activation>
<!-- after -->
<activation>
  <property>
    <name>deployEnv</name>
    <value>production</value>
  </property>
</activation>
Defensive patterns

Strategy: validation

Validate before calling

// Before activating, confirm the property block is well-formed
ActivationProperty p = profile.getActivation().getProperty();
if (p != null && p.getName() == null) {
    skipAndLog("profile '" + profile.getId() + "' has activation property without <name>");
}

Prevention

When it happens

Trigger: A POM profile with <property><value>someValue</value></property> but no <name>; also triggered when name is present but the property element itself is malformed so getName() returns null.

Common situations: Hand-written profiles meant to activate when a property has a value, forgetting the name; refactoring that removes <name> but leaves <value>; profiles inherited from parent POMs; misunderstanding that value without name is meaningless.

Related errors


AI-assisted analysis of apache/maven@e4093d4e12 (2026-08-21). Data as JSON: /api/errors/44f650d4d88915ef. Report an issue: GitHub.