SonarSource/sonarqube · info

This analysis uses the deprecated cross-project duplication…

Error message

This analysis uses the deprecated cross-project duplication feature.

What it means

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.

Solutions

  1. Remove sonar.cpd.cross_project from the analysis configuration.
  2. Re-run the analysis; the warning disappears for subsequent analyses.
  3. If cross-project duplication matters, plan an alternative (e.g. shared modules in a monorepo) since the feature is deprecated.
  4. Acknowledge/dismiss the message on the background task page after confirming.

Example fix

// before (sonar-project.properties)
sonar.cpd.cross_project=true
// after
# property removed
Defensive patterns

Strategy: validation

Validate before calling

# detect the deprecated setting before running analysis
grep -R 'sonar.cpd.cross_project' sonar-project.properties .github/ Jenkinsfile && echo 'remove deprecated cross-project CPD'

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Understand the failure class

Background: "is deprecated and will be removed" — deprecation warnings for old API names, keywords, and options, and how to migrate before the removal release — this error's family across 29 libraries.

Related errors


AI-assisted analysis of SonarSource/sonarqube@184c821202 (2026-09-09). Data as JSON: /api/errors/fcc78c9629c4bef3. Report an issue: GitHub.

Appendix: source

Thrown at server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/duplication/IntegrateCrossProjectDuplications.java:65

  private static final Logger LOGGER = LoggerFactory.getLogger(IntegrateCrossProjectDuplications.class);
  private static final String JAVA_KEY = "java";
  private static final String DEPRECATED_WARNING = "This analysis uses the deprecated cross-project duplication feature.";
  private static final String DEPRECATED_WARNING_DASHBOARD = "This project uses the deprecated cross-project duplication feature.";

  private static final int MAX_CLONE_GROUP_PER_FILE = 100;
  private static final int MAX_CLONE_PART_PER_GROUP = 100;

  private final Configuration config;
  private final DuplicationRepository duplicationRepository;

  private final Map<String, NumberOfUnitsNotLessThan> numberOfUnitsByLanguage = new HashMap<>();

  public IntegrateCrossProjectDuplications(CrossProjectDuplicationStatusHolder crossProjectDuplicationStatusHolder, Configuration config,
    DuplicationRepository duplicationRepository, CeTaskMessages ceTaskMessages, System2 system) {
    this.config = config;
    this.duplicationRepository = duplicationRepository;
    if (crossProjectDuplicationStatusHolder.isEnabled()) {
      LOGGER.warn(DEPRECATED_WARNING);
      ceTaskMessages.add(new CeTaskMessages.Message(DEPRECATED_WARNING_DASHBOARD, system.now()));
    }
  }

  public void computeCpd(Component component, Collection<Block> originBlocks, Collection<Block> duplicationBlocks) {
    CloneIndex duplicationIndex = new PackedMemoryCloneIndex();
    populateIndex(duplicationIndex, originBlocks);
    populateIndex(duplicationIndex, duplicationBlocks);

    List<CloneGroup> duplications = SuffixTreeCloneDetectionAlgorithm.detect(duplicationIndex, originBlocks);
    Iterable<CloneGroup> filtered = duplications.stream()
      .filter(getNumberOfUnitsNotLessThan(component.getFileAttributes().getLanguageKey()))
      .toList();
    addDuplications(component, filtered);
  }

  private static void populateIndex(CloneIndex duplicationIndex, Collection<Block> duplicationBlocks) {
    for (Block block : duplicationBlocks) {

View on GitHub (pinned to 184c821202)