My Custom Rules .java file for COBOL has the following import statements. I found org.sonar.api.plugin in my company’s NEXUS but not able to locate the other 2. Where can I get a copy.
org.sonar.api.Plugin, org.sonar.api.server.profile.BuiltInQualityProfilesDefinition and org.sonar.api.server.rule.RulesDefinition are all contained in the org.sonarsource.api.plugin:sonar-plugin-api artifact. This artifact should be resolvable by maven or gradle.
The sonar-cobol-plugin artifact itself can be found here.
I was able to run mvn clean install for the cobol example plugin after having copied the jar into the lib folder and updating the sonarcobol.version so it matched the downloaded cobol plugin version.
In case the above doesn’t help to solve your issue, what build system are you using to build the plugin? Also, did you start from an example plugin? If yes, which one?
Could you try with the cobol-example-rules project in the custom rules plugin examples. Before compiling, you first have to copy the sonar-cobol plugin into the lib folder and update the sonarcobol.version property in the pom.xml to match the downloaded jar. Afterwards, running mvn clean install should work.
I found a copy of sonar-cobol-plugin.jar in my .sonar folder on my c drive.
I used the jar xf command to get the version number.
I updated <sonar.cobol.plugin.version> in my pom.xml file
Should’t I also change the following to my project info?
cobol-custom-rules
COBOL Custom Rules Plugin
Custom SonarQube COBOL rules and quality profile.
You can change those as well. The groupId can also be changed to something other than org.sonarsource.samples. mvn clean install should work either way.