apache/maven · warning · InvalidArtifactRTException
The version cannot be empty.
Error message
The version cannot be empty.
What it means
--fail-on-severity needs Maven's own SLF4J provider, whose ILoggerFactory also implements org.apache.maven.logging.api.LogLevelRecorder, so Maven can record the maximum level actually logged. If LoggerFactory.getILoggerFactory() returns a different provider (logback, log4j-slf4j2, plain slf4j-simple won the binding race, typical when embedding maven-embedder in an app or via jars on maven.ext.class.path), the recorder cannot be installed, the flag is inert, and this warning explains why.
Source
Thrown at compat/maven-artifact/src/main/java/org/apache/maven/artifact/DefaultArtifact.java:181
}
private void validateIdentity() {
if (empty(groupId)) {
throw new InvalidArtifactRTException(
groupId, artifactId, getVersion(), type, "The groupId cannot be empty.");
}
if (empty(artifactId)) {
throw new InvalidArtifactRTException(
groupId, artifactId, getVersion(), type, "The artifactId cannot be empty.");
}
if (empty(type)) {
throw new InvalidArtifactRTException(groupId, artifactId, getVersion(), type, "The type cannot be empty.");
}
if ((empty(version)) && (versionRange == null)) {
throw new InvalidArtifactRTException(
groupId, artifactId, getVersion(), type, "The version cannot be empty.");
}
}
public static boolean empty(String value) {
return value == null || value.isBlank();
}
@Override
public String getClassifier() {
return classifier;
}
@Override
public boolean hasClassifier() {
return classifier != null && !classifier.isEmpty();
}
View on GitHub (pinned to e4093d4e12)
Solutions
- Remove the competing SLF4J binding from the classpath or ext classpath so maven-slf4j-provider is selected
- Run with -X and look for multiple-SLF4J-provider messages; prune the duplicates
- In embedded setups, enforce the severity policy in the host logging backend configuration instead of --fail-on-severity
- Keep logging implementation jars off maven.ext.class.path entirely
Example fix
<!-- before: transitively pulled logback outranks maven-slf4j-provider -->
<dependency>
<groupId>com.example</groupId>
<artifactId>app-core</artifactId>
</dependency>
<!-- after: exclude the competing binding -->
<dependency>
<groupId>com.example</groupId>
<artifactId>app-core</artifactId>
<exclusions>
<exclusion>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
</exclusion>
</exclusions>
</dependency> Defensive patterns
Strategy: type-guard
Type guard
import org.slf4j.LoggerFactory;
import org.apache.maven.logging.api.LogLevelRecorder;
static boolean failOnSeveritySupported() {
return LoggerFactory.getILoggerFactory() instanceof LogLevelRecorder;
} Prevention
- Keep exactly one SLF4J provider (maven-slf4j-provider) on the Maven classpath
- Never place logging implementation jars on maven.ext.class.path
- When embedding MavenCli, configure severity gates in the host logging backend instead
When it happens
Trigger: Classpath resolution put a foreign SLF4J factory in charge: an application embedding MavenCli that already binds logback or log4j, or an ext-classpath jar shipping a competing SLF4J provider.
Common situations: Embedding Maven in servers or test harnesses; adding rich logging to Maven via ext classpath extensions; duplicate SLF4J providers from shaded plugin dependencies.
Related errors
- Unbounded range: {}
- Ranges overlap: {}
- Only fully-qualified sets allowed in multiple set scenario:
- Single version must be surrounded by []: {}
- The artifact has no valid ranges
AI-assisted analysis of apache/maven@e4093d4e12 (2026-08-21).
Data as JSON: /api/errors/af16b724e1d2f9ce.
Report an issue: GitHub.