Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot run Sonar on impacted modules if only pom-package module is modified #24

Open
robabod opened this issue Sep 5, 2018 · 1 comment

Comments

@robabod
Copy link

robabod commented Sep 5, 2018

In order for Sonar to run on a subset of modules, it necessary to specify each module's parents. For example with a simple project set up as follows, to run Sonar on grandchild1 we need to include container1 and top-level as a minimum.

  • top-level/pom.xml (pom-packaging)
    • container1/pom.xml (pom-packaging)
      • grandchild1/pom.xml
        code
    • container2/pom.xml (pom-packaging)
      • grandchild2/pom.xml
        code

With the partial-build-plugin we can achieve this by using the following flags:

  • partial.impacted=true: ensures any dependant projects are also Sonar'd
  • partial.ignoreAllReactorProjects=true: ensures that all pom-package modules are included

If we make a change in grandchild1, this has the result of selecting top-level, container1, container2, and grandchild1 to run Sonar on.

The problem we are seeing is that if we make a change to only a pom-package module, then the impacted=true has no effect. For example, if we modify container1/pom.xml, then using the settings above only top-level, container and container2 are selected for Sonar. We would expect grandchild1 to be included, as it could have been affected by the change in its parent container (dependency changes, etc).

If we use partial.impacted=true and partial.ignoreAllReactorProjects=false, then we see container1 and grandchild1 selected, but we cannot run Sonar as we would also need top-level to be included.

It seems as if the ignoreAllReactorProjects flag ignores reactor projects when calculating impact, but this flag seems to be the only way to include parent projects in the build (which Sonar needs).

It would be useful to include an option that includes all parents of selected modules. This could be combined with impacted=true to ensure that all modules that have been impacted by the change can be Sonar'd.

Note that because of the size of our code-base, we build the code multi-threaded, and perform Sonar in a separate single-threaded pass (it doesn't seem to cope with multi-thread).

@robabod
Copy link
Author

robabod commented Sep 5, 2018

As a test, I forked the repository and put together a quick change that implements a buildParents parameter, which does roughly what would be needed. It adds all parents of any changed or impacted modules, which would allow running Sonar using the options partial.impacted=true and partial.buildParents=true.

In the example above, if container1/pom.xml were changed, the options would result in top-level, container1 and grandchild1 being built.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant