{"record":{"id":"fcc78c9629c4bef3","repo":"SonarSource/sonarqube","slug":"this-analysis-uses-the-deprecated-cross-project-du","errorCode":null,"errorMessage":"This analysis uses the deprecated cross-project duplication feature.","messagePattern":"This analysis uses the deprecated cross-project duplication feature\\.","errorType":"console","errorClass":null,"httpStatus":null,"severity":"info","filePath":"server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/duplication/IntegrateCrossProjectDuplications.java","lineNumber":65,"sourceCode":"  private static final Logger LOGGER = LoggerFactory.getLogger(IntegrateCrossProjectDuplications.class);\n  private static final String JAVA_KEY = \"java\";\n  private static final String DEPRECATED_WARNING = \"This analysis uses the deprecated cross-project duplication feature.\";\n  private static final String DEPRECATED_WARNING_DASHBOARD = \"This project uses the deprecated cross-project duplication feature.\";\n\n  private static final int MAX_CLONE_GROUP_PER_FILE = 100;\n  private static final int MAX_CLONE_PART_PER_GROUP = 100;\n\n  private final Configuration config;\n  private final DuplicationRepository duplicationRepository;\n\n  private final Map<String, NumberOfUnitsNotLessThan> numberOfUnitsByLanguage = new HashMap<>();\n\n  public IntegrateCrossProjectDuplications(CrossProjectDuplicationStatusHolder crossProjectDuplicationStatusHolder, Configuration config,\n    DuplicationRepository duplicationRepository, CeTaskMessages ceTaskMessages, System2 system) {\n    this.config = config;\n    this.duplicationRepository = duplicationRepository;\n    if (crossProjectDuplicationStatusHolder.isEnabled()) {\n      LOGGER.warn(DEPRECATED_WARNING);\n      ceTaskMessages.add(new CeTaskMessages.Message(DEPRECATED_WARNING_DASHBOARD, system.now()));\n    }\n  }\n\n  public void computeCpd(Component component, Collection<Block> originBlocks, Collection<Block> duplicationBlocks) {\n    CloneIndex duplicationIndex = new PackedMemoryCloneIndex();\n    populateIndex(duplicationIndex, originBlocks);\n    populateIndex(duplicationIndex, duplicationBlocks);\n\n    List<CloneGroup> duplications = SuffixTreeCloneDetectionAlgorithm.detect(duplicationIndex, originBlocks);\n    Iterable<CloneGroup> filtered = duplications.stream()\n      .filter(getNumberOfUnitsNotLessThan(component.getFileAttributes().getLanguageKey()))\n      .toList();\n    addDuplications(component, filtered);\n  }\n\n  private static void populateIndex(CloneIndex duplicationIndex, Collection<Block> duplicationBlocks) {\n    for (Block block : duplicationBlocks) {","sourceCodeStart":47,"sourceCodeEnd":83,"githubUrl":"https://github.com/SonarSource/sonarqube/blob/184c821202192afc1c599fc912d0889b69fffa53/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/duplication/IntegrateCrossProjectDuplications.java#L47-L83","documentation":"The cross-project duplication (CPD across projects) feature is deprecated; when an analysis enables it, this warning is logged and a message is added to the Compute Engine task so the deprecation is visible on the background-task page. The analysis still integrates cross-project duplications, but the feature will be removed in a future SonarQube version.","triggerScenarios":"sonar.cpd.cross_project=true (or equivalent configuration) on an analysis, and the analyzed project actually contains cross-project duplications so IntegrateCrossProjectDuplications is activated with the feature enabled.","commonSituations":"Projects that still carry the old cross-project CPD setting in sonar-project.properties or server configuration after upgrading SonarQube; copy-pasted analysis configs from old setups.","solutions":["Remove sonar.cpd.cross_project from the analysis configuration.","Re-run the analysis; the warning disappears for subsequent analyses.","If cross-project duplication matters, plan an alternative (e.g. shared modules in a monorepo) since the feature is deprecated.","Acknowledge/dismiss the message on the background task page after confirming."],"exampleFix":"// before (sonar-project.properties)\nsonar.cpd.cross_project=true\n// after\n# property removed","handlingStrategy":"validation","validationCode":"# detect the deprecated setting before running analysis\ngrep -R 'sonar.cpd.cross_project' sonar-project.properties .github/ Jenkinsfile && echo 'remove deprecated cross-project CPD'","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Audit analysis configs for sonar.cpd.cross_project after each SonarQube upgrade.","Remove the property and accept per-project duplication only.","Centralize scanner properties so deprecated flags are easy to purge.","Watch background-task messages for deprecation notices."],"tags":["sonarqube","deprecation","duplication","analysis"],"backgroundTag":"deprecated-api-usage","analyzedSha":"184c821202192afc1c599fc912d0889b69fffa53","analyzedAt":"2026-09-09T12:23:51.573Z","contentChangedAt":"2026-09-09T12:23:51.573Z","schemaVersion":2},"datasetVersion":"2026-09-17T15:17:12.973Z"}