How do I set java version for a particular sonarlint scan?

1.6k views Asked by At

I have installed SonarLint eclipse plugin. I would like to see only those issues which are compatible with Java 1.7. Is there an way to set a particular version for running sonar scan? I checked the options and couldn't find anything.

Just to clarify, I don't want to know how to set java version for Sonar itself. I would like to set java versions for individual scans.

1

There are 1 answers

1
G. Ann - SonarSource Team On BEST ANSWER

Depending on your environment, this may not be politically feasible, but I'll answer ignoring politics:

First, you need to set up a rule profile on your SonarQube server that's limited to just the rules you want to see - the Java 7 rules and assign it to your project so only those rules are used in analysis.

Now connect your project in Eclipse to the project on your SonarQube server.

Voila! Only those Java 7 rules are applied in Eclipse.