Giter Site home page Giter Site logo

Findbugs needs sources to be compiled. Please build project before executing sonar or check the location of compiled classes to make it possible for Findbugs to analyse your project. about sonar-findbugs HOT 13 CLOSED

spotbugs avatar spotbugs commented on June 3, 2024
Findbugs needs sources to be compiled. Please build project before executing sonar or check the location of compiled classes to make it possible for Findbugs to analyse your project.

from sonar-findbugs.

Comments (13)

mgreau avatar mgreau commented on June 3, 2024 5

I had the same issue with SonarQube 5.6.1 LTS and sonar-findbugs-plugin-3.4.3.jar.
I fixed it by using the latest sonar-findbugs-plugin-3.4.4.jar (I installed it manually because this version is not yet available in the Update center)

from sonar-findbugs.

h3xstream avatar h3xstream commented on June 3, 2024 3

This will be fixed by #148

Temporarily you can run :

  1. Run mvn findbugs:findbugs
  2. Run mvn sonar:sonar [...]

Make sure that plugins use in Sonar-FindBugs is also configured in your Maven configuration.

Long-term plan

A new configuration to disable compiled code check will be added in 1 or 2 release.

from sonar-findbugs.

peterfortuin avatar peterfortuin commented on June 3, 2024 2

For me it helped to upgrade the sonarqube plugin in gradle to 2.2.1.

plugins {
    id "org.sonarqube" version "2.2.1"
}

from sonar-findbugs.

h3xstream avatar h3xstream commented on June 3, 2024

I'm not familiar with sonar-scanner. I think it is unable to find the build directory.
From what I can see in the documentation, it seems like manual configuration are required by sonar-scanner.

I would try specifying the following variable:

sonar.java.binaries=[YOUR_BUILD_DIR] (target/classes)

from sonar-findbugs.

h3xstream avatar h3xstream commented on June 3, 2024

Let me know if the addition of the property does fix your problem.

I notice that this approach did work for somebody else:
http://stackoverflow.com/questions/39102924/can-not-execute-findbugs-caused-by-this-project-contains-java-source-files-that

from sonar-findbugs.

kstevenard avatar kstevenard commented on June 3, 2024

I have the same issue, what is really weird is that previously it was acting like if there was no rules comming from the findbugs repository then findbugs wasn't executed (could somebody confirm?)
Now for a project i can't get the compiled code, what to do to have the analysis not failing?
upgrade to 3.4.3 was required for us due to migration to SQ 5.6.1

from sonar-findbugs.

StanleyShen avatar StanleyShen commented on June 3, 2024

I have same issue right now.

I tried to compile the code, and tried to add

sonar.java.binaries=test/**/target/classes

But it seems it doesn't work.
The project is maven one with multiple modules defined.

from sonar-findbugs.

steve-todorov avatar steve-todorov commented on June 3, 2024

I'm having the same problem on SonarQube 6.1 with the latest sonar-findbugs-plugin3.4.4.jar and Sonar-Scanner 2.8. This is the exception I'm receiving in Jenkins:

WARN: Findbugs needs sources to be compiled. Please build project before executing sonar or check the location of compiled classes to make it possible for Findbugs to analyse your project.
INFO: ------------------------------------------------------------------------
INFO: EXECUTION FAILURE
INFO: ------------------------------------------------------------------------
INFO: Total time: 19.522s
INFO: Final Memory: 65M/1105M
INFO: ------------------------------------------------------------------------
ERROR: Error during SonarQube Scanner execution
java.lang.IllegalStateException: Can not execute Findbugs
	at org.sonar.plugins.findbugs.FindbugsExecutor.execute(FindbugsExecutor.java:169)
	at org.sonar.plugins.findbugs.FindbugsSensor.execute(FindbugsSensor.java:88)
	at org.sonar.scanner.sensor.SensorWrapper.analyse(SensorWrapper.java:53)
	at org.sonar.scanner.phases.SensorsExecutor.executeSensor(SensorsExecutor.java:57)
	at org.sonar.scanner.phases.SensorsExecutor.execute(SensorsExecutor.java:49)
	at org.sonar.scanner.phases.AbstractPhaseExecutor.execute(AbstractPhaseExecutor.java:78)
	at org.sonar.scanner.scan.ModuleScanContainer.doAfterStart(ModuleScanContainer.java:182)
	at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:142)
	at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:127)
	at org.sonar.scanner.scan.ProjectScanContainer.scan(ProjectScanContainer.java:247)
	at org.sonar.scanner.scan.ProjectScanContainer.scanRecursively(ProjectScanContainer.java:242)
	at org.sonar.scanner.scan.ProjectScanContainer.doAfterStart(ProjectScanContainer.java:232)
	at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:142)
	at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:127)
	at org.sonar.scanner.task.ScanTask.execute(ScanTask.java:47)
	at org.sonar.scanner.task.TaskContainer.doAfterStart(TaskContainer.java:86)
	at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:142)
	at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:127)
	at org.sonar.scanner.bootstrap.GlobalContainer.executeTask(GlobalContainer.java:115)
	at org.sonar.batch.bootstrapper.Batch.executeTask(Batch.java:118)
	at org.sonarsource.scanner.api.internal.batch.BatchIsolatedLauncher.execute(BatchIsolatedLauncher.java:62)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at org.sonarsource.scanner.api.internal.IsolatedLauncherProxy.invoke(IsolatedLauncherProxy.java:60)
	at com.sun.proxy.$Proxy0.execute(Unknown Source)
	at org.sonarsource.scanner.api.EmbeddedScanner.doExecute(EmbeddedScanner.java:233)
	at org.sonarsource.scanner.api.EmbeddedScanner.runAnalysis(EmbeddedScanner.java:151)
	at org.sonarsource.scanner.cli.Main.runAnalysis(Main.java:110)
	at org.sonarsource.scanner.cli.Main.execute(Main.java:74)
	at org.sonarsource.scanner.cli.Main.main(Main.java:61)
Caused by: java.lang.IllegalStateException: This project contains Java source files that are not compiled.
	at org.sonar.plugins.findbugs.FindbugsConfiguration.getFindbugsProject(FindbugsConfiguration.java:120)
	at org.sonar.plugins.findbugs.FindbugsExecutor.execute(FindbugsExecutor.java:119)
	... 31 more

@h3xstream Any ideas what might be causing this?

from sonar-findbugs.

steve-todorov avatar steve-todorov commented on June 3, 2024

I've managed to find the problem. The -Dsonar.sources was being incorrectly set to /java/jenkins/job/my-job/workspace. After changing it to /java/jenkins/job/my-job/workspace/.sonar everything started working.

from sonar-findbugs.

tydaeus avatar tydaeus commented on June 3, 2024

FYI, the sonar.java.binaries assignment only works for me when pointing at the dir containing the intermediary .class files, not at the dir with the final output jar file.

from sonar-findbugs.

nfalco79 avatar nfalco79 commented on June 3, 2024

This bug also hit me.
Actual system SonarQube 5.6.6

  • Web 2.5.0.476
  • SonarJava 4.15.0.12310
  • Findbugs 3.6.0

Recent updates of sonarqube plugins cause a build failure in our Jenkins CI system.
We run sonar as part of maven build using sonar maven plugin with sonar:sonar goal, so I suppose all properties are setup in the correct way. There is a maven module with just web.xml and a couple of JSPs files (like login.jsp). These jsp are not pre-compiled (and we don't want).
Before the plugin update all works.

[INFO] ------------- Scan acme.model.admin.ui.web master
[INFO] Excluded sources for coverage:
[INFO] test/**
[INFO] **/*NLS.java
[INFO] **/*DTO.java
[INFO] **/*Dto.java
[INFO] **/*Bean.java
[INFO] **/*Constants.java
[INFO] **/*Consts.java
[INFO] Base dir: /var/lib/jenkins/workspace/acme_master-AZ5ORYFOO25DAUG767DB32IPS36JL64GOEK6QCFL6266VKWQXSCQ/bundles/acme.model.admin.ui.web
[INFO] Working dir: /var/lib/jenkins/workspace/acme_master-AZ5ORYFOO25DAUG767DB32IPS36JL64GOEK6QCFL6266VKWQXSCQ/bundles/acme.model.admin.ui.web/target/sonar
[INFO] Source paths: pom.xml, src
[INFO] Binary dirs: target/classes
[INFO] Source encoding: UTF-8, default locale: en_US
[INFO] Index files
[INFO] Excluded sources:
[INFO] **/*NLS.java
[INFO] **/*DTO.java
[INFO] **/Dto.java
[INFO] /*Bean.java
[INFO] /Constants.java
[INFO] /*Consts.java
[INFO] file:
/src-gen/

[INFO] file:
/test-gen/

[INFO] 3 files indexed
[INFO] 0 files ignored because of inclusion/exclusion patterns
[INFO] Quality profile for jsp: FindBugs Security JSP
[INFO] Sensor Lines Sensor
[INFO] Sensor Lines Sensor (done) | time=1ms
[INFO] Sensor SCM Sensor
[INFO] Sensor SCM Sensor (done) | time=1ms
[INFO] Sensor jsp
[INFO] Sensor jsp (done) | time=106ms
[INFO] Sensor FindBugs Sensor
[INFO] JavaClasspath initialization
[INFO] JavaClasspath initialization (done) | time=4ms
[WARNING] Findbugs needs sources to be compiled. Please build project before executing sonar or check the location of compiled classes to make it possible for Findbugs to analyse your (sub)project (/var/lib/jenkins/workspace/acme_master-AZ5ORYFOO25DAUG767DB32IPS36JL64GOEK6QCFL6266VKWQXSCQ/bundles/acme.model.admin.ui.web).

Do you have suggestion to fix the issue?

from sonar-findbugs.

pgodithi avatar pgodithi commented on June 3, 2024

Hey I am using oracle java 10 and using sonar for code analysis, getting the following error, can anyone tell me the solution for this.
sonarqube version: 6.7.3
find bugs plugin: 3.7.0

at edu.umd.cs.findbugs.FindBugs2.execute(FindBugs2.java:275)
at org.sonar.plugins.findbugs.FindbugsExecutor$FindbugsTask.call(FindbugsExecutor.java:235)

Caused by: java.lang.IllegalStateException: Can not execute Findbugs

from sonar-findbugs.

haribalaji89 avatar haribalaji89 commented on June 3, 2024

I am using oracle java 8, Sonarqube server : 6.7 and Apache Ant(TM) version 1.10.5
ran into same error as above in Findbugs.

Caused by: java.lang.IllegalStateException: Can not execute Findbugs
Caused by: java.nio.file.InvalidPathException: Illegal char <*> at index 0: /lib/
at sun.nio.fs.WindowsPathParser.normalize(WindowsPathParser.java:182)
at sun.nio.fs.WindowsPathParser.parse(WindowsPathParser.java:153)
at sun.nio.fs.WindowsPathParser.parse(WindowsPathParser.java:77)
at sun.nio.fs.WindowsPath.parse(WindowsPath.java:94)
at sun.nio.fs.WindowsFileSystem.getPath(WindowsFileSystem.java:255)
at sun.nio.fs.AbstractPath.resolve(AbstractPath.java:53)
at org.sonar.api.scan.filesystem.PathResolver.relativeFile(PathResolver.java:44)
at org.sonar.plugins.findbugs.FindbugsConfiguration.getExcludesFilters(FindbugsConfiguration.java:214)
at org.sonar.plugins.findbugs.FindbugsExecutor.execute(FindbugsExecutor.java:152)

appreciate any help related to this

from sonar-findbugs.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.