apache/maven · warning
Overriding profile: '{}' (source: {}) with new instance from
Error message
Overriding profile: '{}' (source: {}) with new instance from source: {} What it means
Warning logged by DefaultProfileManager.addProfile when a profile with the same id is registered twice: the previous instance (and its source, e.g. 'settings.xml', 'pom.xml', 'profiles.xml') is replaced by the new one. Last registration wins; activation properties of the discarded profile are lost. It is diagnostic only, but silent behavior changes can follow because the effective profile differs from what the user expects.
Source
Thrown at compat/maven-compat/src/main/java/org/apache/maven/profiles/DefaultProfileManager.java:105
public Properties getRequestProperties() {
return requestProperties;
}
@Override
public Map<String, Profile> getProfilesById() {
return profilesById;
}
/* (non-Javadoc)
* @see org.apache.maven.profiles.ProfileManager#addProfile(org.apache.maven.model.Profile)
*/
@Override
public void addProfile(Profile profile) {
String profileId = profile.getId();
Profile existing = profilesById.get(profileId);
if (existing != null) {
logger.warn("Overriding profile: '" + profileId + "' (source: " + existing.getSource()
+ ") with new instance from source: " + profile.getSource());
}
profilesById.put(profile.getId(), profile);
Activation activation = profile.getActivation();
if (activation != null && activation.isActiveByDefault()) {
activateAsDefault(profileId);
}
}
/* (non-Javadoc)
* @see org.apache.maven.profiles.ProfileManager#explicitlyActivate(java.lang.String)
*/
@Override
public void explicitlyActivate(String profileId) {
if (!activatedIds.contains(profileId)) {View on GitHub (pinned to e4093d4e12)
Solutions
- Search all sources for the id: grep -r '<id>NAME</id>' across pom.xml, ~/.m2/settings.xml, and any injected profiles.
- Rename one of the profiles so both can coexist, or delete the duplicate you do not need.
- If inheritance overwriting is intended (child redefines parent profile), keep it but be aware the parent's activation is fully replaced.
- For plugin/embedder authors: check profilesById before addProfile, or namespace programmatic profile ids.
Example fix
<!-- before: same id in settings.xml and pom.xml --> <profile><id>dev</id>...</profile> <!-- after: rename in pom.xml --> <profile><id>project-dev</id>...</profile>
Defensive patterns
Strategy: validation
Validate before calling
// embedder: check before adding
Profile existing = profileManager.getProfilesById().get(profile.getId());
if (existing != null && !existing.getSource().equals(profile.getSource())) {
throw new IllegalStateException("duplicate profile id from " + profile.getSource());
} Prevention
- Namespace custom profile ids (e.g. com.corp.dev) to avoid collisions with pom profiles.
- Audit settings.xml profiles when onboarding shared corporate settings.
- Remember last-registered profile wins; verify effective profile with help:effective-settings / help:active-profiles.
When it happens
Trigger: The same profile id is defined in more than one source processed by the ProfileManager: settings.xml plus pom.xml, two poms in an inheritance chain, or profiles injected programmatically (e.g. via MavenExecutionRequest.addProfile) that collide with file-defined ids.
Common situations: A corporate settings.xml ships a 'local-dev' profile while the project pom.xml also defines 'local-dev'; IDEs injecting profiles with generic ids; copy-pasted profiles between parent and child POMs.
Related errors
- Only fully-qualified sets allowed in multiple set scenario:
- Single version must be surrounded by []: {}
- The artifact has no valid ranges
- Cannot read toolchains file at " + userToolchainsFile.getAbs
- Provides token '" + key + "' doesn't have any value configur
AI-assisted analysis of apache/maven@e4093d4e12 (2026-08-21).
Data as JSON: /api/errors/5dee01158d8de9d7.
Report an issue: GitHub.