{"record":{"id":"af16b724e1d2f9ce","repo":"apache/maven","slug":"the-version-cannot-be-empty","errorCode":null,"errorMessage":"The version cannot be empty.","messagePattern":"The version cannot be empty\\.","errorType":"validation","errorClass":"InvalidArtifactRTException","httpStatus":null,"severity":"warning","filePath":"compat/maven-artifact/src/main/java/org/apache/maven/artifact/DefaultArtifact.java","lineNumber":181,"sourceCode":"    }\n\n    private void validateIdentity() {\n        if (empty(groupId)) {\n            throw new InvalidArtifactRTException(\n                    groupId, artifactId, getVersion(), type, \"The groupId cannot be empty.\");\n        }\n\n        if (empty(artifactId)) {\n            throw new InvalidArtifactRTException(\n                    groupId, artifactId, getVersion(), type, \"The artifactId cannot be empty.\");\n        }\n\n        if (empty(type)) {\n            throw new InvalidArtifactRTException(groupId, artifactId, getVersion(), type, \"The type cannot be empty.\");\n        }\n\n        if ((empty(version)) && (versionRange == null)) {\n            throw new InvalidArtifactRTException(\n                    groupId, artifactId, getVersion(), type, \"The version cannot be empty.\");\n        }\n    }\n\n    public static boolean empty(String value) {\n        return value == null || value.isBlank();\n    }\n\n    @Override\n    public String getClassifier() {\n        return classifier;\n    }\n\n    @Override\n    public boolean hasClassifier() {\n        return classifier != null && !classifier.isEmpty();\n    }\n","sourceCodeStart":163,"sourceCodeEnd":199,"githubUrl":"https://github.com/apache/maven/blob/e4093d4e120eac99d6bdce5ba67cace2f3085c97/compat/maven-artifact/src/main/java/org/apache/maven/artifact/DefaultArtifact.java#L163-L199","documentation":"--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.","triggerScenarios":"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.","commonSituations":"Embedding Maven in servers or test harnesses; adding rich logging to Maven via ext classpath extensions; duplicate SLF4J providers from shaded plugin dependencies.","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"],"exampleFix":"<!-- before: transitively pulled logback outranks maven-slf4j-provider -->\n<dependency>\n  <groupId>com.example</groupId>\n  <artifactId>app-core</artifactId>\n</dependency>\n<!-- after: exclude the competing binding -->\n<dependency>\n  <groupId>com.example</groupId>\n  <artifactId>app-core</artifactId>\n  <exclusions>\n    <exclusion>\n      <groupId>ch.qos.logback</groupId>\n      <artifactId>logback-classic</artifactId>\n    </exclusion>\n  </exclusions>\n</dependency>","handlingStrategy":"type-guard","validationCode":null,"typeGuard":"import org.slf4j.LoggerFactory;\nimport org.apache.maven.logging.api.LogLevelRecorder;\n\nstatic boolean failOnSeveritySupported() {\n    return LoggerFactory.getILoggerFactory() instanceof LogLevelRecorder;\n}","tryCatchPattern":null,"preventionTips":["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"],"tags":["maven","slf4j","logging","classpath","maven-embedder"],"backgroundTag":"slf4j-multiple-bindings","analyzedSha":"e4093d4e120eac99d6bdce5ba67cace2f3085c97","analyzedAt":"2026-08-21T22:58:24.034Z","schemaVersion":2},"datasetVersion":"2026-08-22T04:17:13.399Z"}