Open robabod opened 6 years ago
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.
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 includecontainer1
andtop-level
as a minimum.top-level/pom.xml
(pom-packaging)container1/pom.xml
(pom-packaging)grandchild1/pom.xml
codecontainer2/pom.xml
(pom-packaging)grandchild2/pom.xml
codeWith the
partial-build-plugin
we can achieve this by using the following flags:partial.impacted=true
: ensures any dependant projects are also Sonar'dpartial.ignoreAllReactorProjects=true
: ensures that all pom-package modules are includedIf we make a change in
grandchild1
, this has the result of selectingtop-level
,container1
,container2
, andgrandchild1
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 modifycontainer1/pom.xml
, then using the settings above onlytop-level
,container
andcontainer2
are selected for Sonar. We would expectgrandchild1
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
andpartial.ignoreAllReactorProjects=false
, then we seecontainer1
andgrandchild1
selected, but we cannot run Sonar as we would also needtop-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).