java - activate/deactivate sonar maven plugin by profile? -


i use sonar plugin executes if activated in maven profile. sonar runs on every compile.

the problem build fail other team members not have sonar application installed locally. pom.xml checked in team members same copy including sonar configuration, don't want them modify purpose of disabling sonar (they might inadvertently check modified copy in).

please advise how configure maven (.m2/settings.xml) and/or pom.xml sonar feature can enabled/disabled local profile.

here sonar configuration in each project's pom.xml:

<plugin>     <groupid>org.codehaus.mojo</groupid>     <artifactid>sonar-maven-plugin</artifactid>     <version>1.0</version>     <executions>         <execution>             <id>make-sonar</id>             <phase>compile</phase>             <goals>                 <goal>sonar</goal>             </goals>         </execution>     </executions> </plugin> 

just include configuration within maven profile:

<profiles>     <profile>         <id>sonar</id>         <build>             <plugins>             <!-- sonar config here -->             </plugins>         </build>     </profile> </profiles> 

then invoke maven profile enabled: mvn clean install -psonar

as of maven 2.09 can automatically enable plugin based upon presence of file. add following activation above profile:

<activation>     <file>         <exists>/full/path/to/sonar/installation</exists>     </file> </activation> 

if absolute paths make itchy (like me), exists can interpolate system properties. can go overboard, , poms shouldn't know system upon project built, tread carefully.

your woes indicative of deeper problem: why you looking @ sonarqube? software quality shared effort, , sonarqube thrives running automatically in central location. want install sonarqube in ci environment , run analysis on each build. , coworkers can run sonarqube ide check work before committing.


Comments

Popular posts from this blog

python - TypeError: can only concatenate tuple (not "float") to tuple -

java - What is the difference between String. and String.this. ? -