apache/maven · warning
Failed to activate profiles for CI-friendly version processi
Error message
Failed to activate profiles for CI-friendly version processing: {} What it means
During interpolation-property collection for CI-friendly versions (${revision}, ${sha1}, ${changelist}), DefaultModelBuilder's getPropertiesWithProfiles() performs a lightweight profile activation to merge profile properties. Any exception from that activation is caught, warned with the exception's message, and processing continues with base properties only (model properties plus system/user properties). The intent is that CI-friendly version interpolation keeps working even when a profile activator misbehaves; the cost is that properties from the failing profile are missing, which can leave a ${...} uninterpolated downstream.
Source
Thrown at impl/maven-impl/src/main/java/org/apache/maven/impl/model/DefaultModelBuilder.java:793
properties.putAll(baseProperties);
// Add model properties
properties.putAll(model.getProperties());
try {
// Create a profile activation context for this model with base properties available
DefaultProfileActivationContext profileContext = getProfileActivationContext(request, model);
// Activate profiles and merge their properties
List<Profile> activeProfiles = getActiveProfiles(model.getProfiles(), profileContext);
for (Profile profile : activeProfiles) {
properties.putAll(profile.getProperties());
}
} catch (Exception e) {
// If profile activation fails, log a warning but continue with base properties
// This ensures that CI-friendly versions still work even if profile activation has issues
logger.warn("Failed to activate profiles for CI-friendly version processing: {}", e.getMessage());
logger.debug("Profile activation failure details", e);
}
// System and user properties override everything (use request properties
// to ensure consistency with model interpolation, which also uses request properties)
properties.putAll(request.getSystemProperties());
properties.putAll(request.getUserProperties());
return properties;
}
/**
* Convenience method for getting properties with profiles without additional base properties.
* This is a backward compatibility method that provides an empty base properties map.
*/
private Map<String, String> getPropertiesWithProfiles(Model model) {
return getPropertiesWithProfiles(model, new HashMap<>());
}View on GitHub (pinned to e4093d4e12)
Solutions
- Run with -X to get the full stack trace of the profile activation failure (logged at DEBUG under 'Profile activation failure details')
- Fix or simplify the failing activation condition in the named profile (file exists, JDK range, OS family)
- Define the CI-friendly properties explicitly on the command line so interpolation does not depend on profile activation: -Drevision=1.2.3
- Move the properties needed for interpolation into a profile that has no activator, or into <properties> directly
Example fix
<!-- before: revision only defined in a profile whose activator fails -->
<profiles>
<profile>
<id>ci</id>
<activation>
<file><missing>target/.deploy-marker</missing></file>
</activation>
<properties><revision>1.0.0</revision></properties>
</profile>
</profiles>
<!-- after: always supply revision from CLI in CI -->
mvn deploy -Drevision=1.0.0 Defensive patterns
Strategy: fallback
Validate before calling
// Supply CI-friendly versions explicitly so interpolation never depends on profile activation
// pom.xml: <version>${revision}</version>
// CI: pass the properties on every invocation
// mvn deploy -Drevision=1.0.0 -Dchangelist= -Dsha1=
String revision = session.getUserProperties().get("revision");
if (revision == null || revision.isBlank()) {
throw new IllegalStateException("-Drevision must be set: CI-friendly version relies on it");
} Prevention
- Always pass -Drevision (and -Dsha1/-Dchangelist) on the CI command line
- Keep profiles that define interpolation-critical properties free of fragile activators (file/JDK conditions)
- Run with -X once to capture the DEBUG stack trace when this warning appears, then fix that activator
- Test profile activation with mvn help:active-profiles in the exact CI environment
When it happens
Trigger: A project uses ${revision} as version and one of its profiles throws during activation: a custom ProfileActivator throwing from an embedding plugin, a file-based activation condition on an unreadable path, or a JDK/os condition raising an unexpected runtime error inside getActiveProfiles(). The warning names the exception message; the stack trace appears at DEBUG.
Common situations: CI-friendly setups where the profile defining 'revision' also contains an activator that fails in restricted CI environments; property-based activation referencing system properties absent on agents; mixed Maven versions where an activator implementation changed behavior.
Related errors
- Repository list contains duplicate entries. Each repository
- Cannot serialize project model for interpolation.
- Cannot read project model from interpolating filter of seria
- Failed to interpolate field: " + field + " on class: " + cls
- The token '%s' at position '%d' refers to a java.util.Map, b
AI-assisted analysis of apache/maven@e4093d4e12 (2026-08-21).
Data as JSON: /api/errors/5d44ae65b82d209b.
Report an issue: GitHub.