{"record":{"id":"5d44ae65b82d209b","repo":"apache/maven","slug":"failed-to-activate-profiles-for-ci-friendly-versio","errorCode":null,"errorMessage":"Failed to activate profiles for CI-friendly version processing: {}","messagePattern":"Failed to activate profiles for CI-friendly version processing: (.+?)","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"impl/maven-impl/src/main/java/org/apache/maven/impl/model/DefaultModelBuilder.java","lineNumber":793,"sourceCode":"            properties.putAll(baseProperties);\n\n            // Add model properties\n            properties.putAll(model.getProperties());\n\n            try {\n                // Create a profile activation context for this model with base properties available\n                DefaultProfileActivationContext profileContext = getProfileActivationContext(request, model);\n\n                // Activate profiles and merge their properties\n                List<Profile> activeProfiles = getActiveProfiles(model.getProfiles(), profileContext);\n\n                for (Profile profile : activeProfiles) {\n                    properties.putAll(profile.getProperties());\n                }\n            } catch (Exception e) {\n                // If profile activation fails, log a warning but continue with base properties\n                // This ensures that CI-friendly versions still work even if profile activation has issues\n                logger.warn(\"Failed to activate profiles for CI-friendly version processing: {}\", e.getMessage());\n                logger.debug(\"Profile activation failure details\", e);\n            }\n\n            // System and user properties override everything (use request properties\n            // to ensure consistency with model interpolation, which also uses request properties)\n            properties.putAll(request.getSystemProperties());\n            properties.putAll(request.getUserProperties());\n\n            return properties;\n        }\n\n        /**\n         * Convenience method for getting properties with profiles without additional base properties.\n         * This is a backward compatibility method that provides an empty base properties map.\n         */\n        private Map<String, String> getPropertiesWithProfiles(Model model) {\n            return getPropertiesWithProfiles(model, new HashMap<>());\n        }","sourceCodeStart":775,"sourceCodeEnd":811,"githubUrl":"https://github.com/apache/maven/blob/e4093d4e120eac99d6bdce5ba67cace2f3085c97/impl/maven-impl/src/main/java/org/apache/maven/impl/model/DefaultModelBuilder.java#L775-L811","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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"],"exampleFix":"<!-- before: revision only defined in a profile whose activator fails -->\n<profiles>\n  <profile>\n    <id>ci</id>\n    <activation>\n      <file><missing>target/.deploy-marker</missing></file>\n    </activation>\n    <properties><revision>1.0.0</revision></properties>\n  </profile>\n</profiles>\n\n<!-- after: always supply revision from CLI in CI -->\nmvn deploy -Drevision=1.0.0","handlingStrategy":"fallback","validationCode":"// Supply CI-friendly versions explicitly so interpolation never depends on profile activation\n// pom.xml: <version>${revision}</version>\n// CI: pass the properties on every invocation\n// mvn deploy -Drevision=1.0.0 -Dchangelist= -Dsha1=\nString revision = session.getUserProperties().get(\"revision\");\nif (revision == null || revision.isBlank()) {\n    throw new IllegalStateException(\"-Drevision must be set: CI-friendly version relies on it\");\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["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"],"tags":["maven","ci-friendly-versions","profile-activation","interpolation"],"backgroundTag":"maven-profile-activation-failure","analyzedSha":"e4093d4e120eac99d6bdce5ba67cace2f3085c97","analyzedAt":"2026-08-21T22:58:24.034Z","schemaVersion":2},"datasetVersion":"2026-08-21T23:17:16.201Z"}