Reputation: 815
I am working in a large project where we have multiple modules, each as their own maven project with a common parent pom.
Among other things, the parent pom defines the Sonar integration on our build server. Our Sonar plugin on the build server evaluates the property "sonar.exclusions" in order to skip files which we do not want to be analysed.
For that purpose, we define a property in the parent pom:
<properties>
<sonar.exclusion>**/generated/**/*,**/migration/**/*</sonar.exclusions>
</properties>
Now, in one of our projects, we want to add to this exclusion list. I do not want to replace those exclusions defined in the parent but I also do not want to repeat them. What I am looking for is something along these lines:
<properties>
<sonar.exclusions>${sonar.exclusions},**/shadow/compare/**/*</sonar.exclusions>
</properties>
In the end, I want the content of ${sonar.exclusions} to be
**/generated/**/*,**/migration/**/*,**/shadow/compare/**/*
However, trying the above results in an error:
pom.xml has 1 error [main] ERROR org.apache.maven.cli.MavenCli - Resolving expression: ${sonar.exclusions}': Detected the following recursive expression cycle in 'sonar.exclusions': [sonar.exclusions]
Is there a way to achieve what I want?
Upvotes: 4
Views: 2079
Reputation: 35795
You can define a property <sonar.standard.exclusions>
in your parent POM that contains your standard exclusions and set <sonar.exclusions>${sonar.standard.exclusions}</sonar.exclusions>
Then you can overwrite the property in your POM as
<sonar.exclusions>${sonar.standard.exclusions},**/shadow/compare/**/*</sonar.exclusions>
Upvotes: 5