简体   繁体   中英

Sonar / findbugs fails when root project doesn't contains any classes

In a Java project, I'm using Sonar with Maven and it's work fine with "sonar way" profile. But when switching to the "Sonar way with Findbugs" profile, it fails :

"Can not execute Sonar: Can not execute Findbugs: Findbugs needs sources to be compiled. Please build project before executing sonar and check the location of compiled classes."

The project is correctly build before the execution of Sonar. But the root module / project doesn't contains any classes. So target/classes is empty

My project is composed of several modules and a root pom.xml

Project

| _ Module 1

| _ Module 2

| _ Module 3

pom.xml

Sonar is running fine for every modules and try to analyze the root project but this one doesn't contains any classes so it fails.

Is there a way to exclude the root project / module (exclude root module is not possible) or tell sonar to only generate a warning in this case or another solution?

Thanks in advance.

I assume you are not facing a sonar or findbugs problem, but you probably have a maven specific problem, eg a problem with your multi module pom - you actually even stated it "target/classes is empty". Focus on that before focusing on sonar or findbugs. As a workaround, try setting up a jenkins build for a specific module first. When this is properly built with class files in your target folder, add a sonar goal to your jenkins project and I'd expect it to work.

ps: Compare: Maven sonar findbugs fails with no source to compile

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM