Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sonar 7.9 LTS warnings #278

Closed
reitzmichnicht opened this issue Jul 8, 2019 · 2 comments · Fixed by #279

Comments

@reitzmichnicht
Copy link

commented Jul 8, 2019

Issue Description

When running with SonarQube 7.9 LTS the following warning comes from the sonar-maven-plugin:

Component of type class org.sonar.plugins.findbugs.FindbugsConfiguration defines methods start() and/or stop(). Neither will be invoked to start/stop the component. Please implement either org.picocontainer.Startable or org.sonar.api.Startable

Environment

Component Version
SonarQube 7.9 LTS
Sonar-FindBugs 3.11.0
Maven 3.6.1
Java 11
@KengoTODA

This comment has been minimized.

Copy link
Member

commented Jul 9, 2019

Haven't tested but I hope this can solve our problem:

diff --git a/src/main/java/org/sonar/plugins/findbugs/FindbugsConfiguration.java b/src/main/java/org/sonar/plugins/findbugs/FindbugsConfiguration.java
index 81d7cd0..6c19a39 100644
--- a/src/main/java/org/sonar/plugins/findbugs/FindbugsConfiguration.java
+++ b/src/main/java/org/sonar/plugins/findbugs/FindbugsConfiguration.java
@@ -42,6 +42,7 @@ import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.sonar.api.CoreProperties;
 import org.sonar.api.PropertyType;
+import org.sonar.api.Startable;
 import org.sonar.api.batch.ScannerSide;
 import org.sonar.api.batch.fs.FilePredicates;
 import org.sonar.api.batch.fs.FileSystem;
@@ -62,7 +63,7 @@ import org.sonar.plugins.java.api.JavaResourceLocator;
 import static java.lang.String.format;
 
 @ScannerSide
-public class FindbugsConfiguration {
+public class FindbugsConfiguration implements Startable {
 
   private static final Logger LOG = LoggerFactory.getLogger(FindbugsConfiguration.class);
 
@@ -117,7 +118,7 @@ public class FindbugsConfiguration {
       LOG.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 (sub)project ({}).", fileSystem.baseDir().getPath());
-      
+
       if (!isAllowUncompiledCode() && hasSourceFiles()) { //This excludes test source files
         throw new IllegalStateException(format("One (sub)project contains Java source files that are not compiled (%s).",
                 fileSystem.baseDir().getPath()));
@@ -281,10 +282,16 @@ public class FindbugsConfiguration {
     }
   }
 
+  @Override
+  public void start() {
+    // do nothing
+  }
+
   /**
    * Invoked by PicoContainer to remove temporary files.
    */
   @SuppressWarnings("RV_RETURN_VALUE_IGNORED_BAD_PRACTICE")
+  @Override
   public void stop() {
     if (jsr305Lib != null) {
       jsr305Lib.delete();
@KengoTODA

This comment has been minimized.

Copy link
Member

commented Jul 15, 2019

Confirmed that our smoke-test reproduces this problem. I will try to make a topic-branch to confirm the fix.

KengoTODA added a commit that referenced this issue Jul 15, 2019
Since SonarQube 7.9, plugin needs to implement org.sonar.api.Startable
explicitly, or SQ reports warning during the code scan.
KengoTODA added a commit that referenced this issue Jul 15, 2019
Since SonarQube 7.9, plugin needs to implement org.sonar.api.Startable
explicitly, or SQ reports warning during the code scan.
KengoTODA added a commit that referenced this issue Jul 17, 2019
Since SonarQube 7.9, plugin needs to implement org.sonar.api.Startable
explicitly, or SQ reports warning during the code scan.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.