Sonar-Problem with Jenkins - getFile()Ljava/io/File

Hello *

we upgraded from Sonar 6.7.5 to 8.6 - but without a database-migration. so its basically new and fresh installation. we copied our old jenkins-job and made a new maven-profil for the jobs.

But on every run we get

Caused by: org.apache.maven.plugin.PluginContainerException: An API incompatibility was encountered while executing org.sonarsource.scanner.maven:sonar-maven-plugin:3.7.0.1746:sonar: java.lang.NoSuchMethodError: org.sonar.plugins.java.api.JavaFileScannerContext.getFile()Ljava/io/File;

  • we tried different sonar-maven-plugins (3.5, 3.7. 3.8).
  • we tried different java-versions (openjdk-8u232, jdk1.8.0_271)
  • there is no jsf in the pom-file (hint in google-search)
  • findbugs-plugin is installed in version 4.0.3 (hint in google-search)

has anybody an idea to fix the problem?

Hey Martin,

Thanks for your message and welcome to the community. Could you please provide a more detailed stacktrace and a version of Java analyser you used before and are using now?

One possible idea that came to my mind, do you have any custom rules?

Regards,
Margarita

Hi Margarita,

In my case I get same error when run scan on last LTS version (8.9) with custom rules. What is your idea?

Thanks in advance

Hey @jose.jimenezp,

The thing is that you were using JavaFileScanner#getFile() method, which was deprecated since SonarJava 5.12 and now is removed.

You need to replace it with getInputFile() method from the same class.

Regards,
Margarita

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.