Uploaded image for project: 'SonarQube'
  1. SonarQube
  2. SONAR-10536

It's no longer possible to analyse a module that was removed from another project

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 6.7.3, 7.1
    • Component/s: Scanner, Web API
    • Labels:
      None

      Description

      Use Case

      • Analyse the project P having module M
      • Analyse the project P without the module M
      • Try to analyse the module M as a standalone project, the scanner is failing with
        [ERROR] Failed to execute goal org.sonarsource.scanner.maven:sonar-maven-plugin:3.4.0.905:sonar (default-cli) on project P: Component 'M' is not a project, The project 'M' is already defined in SonarQube but as a module of project 'P'. If you really want to stop directly analysing project 'P', please first delete it from SonarQube and then relaunch the analysis of project 'M'.
        

      Investigation

      When the project is analysed without the module, the module remains in database as a disabled component.
      When checking if component keys are valid, the web service api/ce/submit is taking into account this disabled module whereas it should not

      Solution

      The key of the disabled module should be renamed in project P. For the time being the administration console to update keys does not display disabled modules, so the only way to achieve that is to send a POST request:

      curl -u admin:admin -X POST "http://localhost/api/projects/update_key?from=M&to=M-moved"
      

      Rejected Alternatives

      The following solutions have been rejected for the time being:

      1. automatically delete disabled modules when compute engine needs to reuse the key. Partial deletion of components tree is not technically possible because of Elasticsearch indexing. Only full projects can be deleted and removed from Elasticsearch indices.
      2. automatically rename the key of disabled module from Compute Engine. Two reasons to not go into this direction:
        1. what would be the new key?
        2. initial project should be reindexed from analysis of second project. That may lead to concurrency errors.
      3. display disabled modules in administration console of key update. Requires webapp to not use public web service api/components/tree that does not/won't return disabled components.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                simon.brandhof Simon Brandhof
                Reporter:
                julien.lancelot Julien Lancelot
              • Votes:
                1 Vote for this issue
                Watchers:
                6 Start watching this issue

                Dates

                • Due:
                  Created:
                  Updated:
                  Resolved: