apache/maven · warning · IllegalArgumentException
Repository list contains duplicate entries. Each repository
Error message
Repository list contains duplicate entries. Each repository must be unique based on its ID and URL. Found {} repositories but only {} unique entries. What it means
Maven evaluates a profile <activation><file><missing>...</missing> condition by running the configured interpolator over the path expression before checking file existence. If interpolation throws InterpolationException (typically a ${...} expression such as ${env.VAR} or a property that cannot be resolved at activation time), FileProfileActivator catches it, logs this warning (stack trace only with -X), falls through to return false, and the profile is silently treated as NOT active.
Source
Thrown at api/maven-api-core/src/main/java/org/apache/maven/api/services/RepositoryAwareRequest.java:106
* <li>Ensures no duplicate repositories exist in the list</li>
* <li>Ensures no null repository entries exist in the list</li>
* </ul>
*
* <p>Duplicate detection is based on the {@code RemoteRepository#equals(Object)}
* method, which typically compares repository IDs and URLs.
*
* @param repositories the list of repositories to validate, may be {@code null}
* @return the same list if validation passes, or {@code null} if input was {@code null}
* @throws IllegalArgumentException if the list contains duplicate repositories
* @throws IllegalArgumentException if the list contains null repository entries
*/
default List<RemoteRepository> validate(List<RemoteRepository> repositories) {
if (repositories == null) {
return null;
}
HashSet<RemoteRepository> set = new HashSet<>(repositories);
if (repositories.size() != set.size()) {
throw new IllegalArgumentException(
"Repository list contains duplicate entries. Each repository must be unique based on its ID and URL. "
+ "Found " + repositories.size() + " repositories but only " + set.size()
+ " unique entries.");
}
if (repositories.stream().anyMatch(Objects::isNull)) {
throw new IllegalArgumentException(
"Repository list contains null entries. All repository entries must be non-null RemoteRepository instances.");
}
return repositories;
}
}
View on GitHub (pinned to e4093d4e12)
Solutions
- Define the referenced property before the build: -Dprop=value on the mvn command line, <properties> in the POM, or a settings.xml profile
- Run mvn -X once and read the logged InterpolationException stack to identify the exact expression that fails
- Replace the expression with a literal path relative to the module basedir (for example target/skip-tests.flag), which needs no interpolation
- If the marker file is not essential, remove the <missing> condition or switch to <exists> with a stable file
Example fix
<!-- before -->
<activation>
<file>
<missing>${env.CI_MARKER}/skip-tests.flag</missing>
</file>
</activation>
<!-- after: literal module-relative path, no interpolation needed -->
<activation>
<file>
<missing>target/skip-tests.flag</missing>
</file>
</activation> Defensive patterns
Strategy: validation
Validate before calling
# fail fast if profile <file> activation still contains unresolved expressions
grep -nE '<(missing|exists)>[^<]*\$\{[^}]+\}' pom.xml */pom.xml && {
echo 'unresolved expression in profile <file> activation; define the property or use a literal path'
exit 1
} Prevention
- Prefer literal, module-relative paths in <file> activation conditions
- Define every property referenced by activation expressions in both developer and CI environments
- Run CI builds with -X so interpolation failures include their stack traces
- Add maven-enforcer-plugin requireProperty rules for properties your activations depend on
When it happens
Trigger: A POM declares <activation><file><missing>${some.expression}/marker</missing></file></activation> and the referenced property or environment variable is undefined when Maven evaluates profile activation; every build emits the warning and the profile never activates.
Common situations: CI agents missing an env var referenced in the activation; a typo in the property name inside <missing>; the property being defined only in one developer's settings.xml profile; activation expressions written for a different Maven version whose activation context exposes different keys.
Related errors
- Repository list contains null entries. All repository entrie
- Bad substitution operator in: ${variable}
- Failed to activate profiles for CI-friendly version processi
- groupId can neither be null, empty nor blank
- artifactId can neither be null, empty nor blank
AI-assisted analysis of apache/maven@e4093d4e12 (2026-08-21).
Data as JSON: /api/errors/29a037c53521dead.
Report an issue: GitHub.