1

We have a multi-module project built with apache-maven 3.0.5.

Here is the setup:

  • Running Sonar plugin through Jenkins.
  • SonarQube server along with MySQL resides on another computer.
  • Use Sonar plugin on Jenkins to run analysis which then pushes results to SonarQube server.

Here are the warnings I am getting when running a Sonar job.

**These warnings does not seem to have an effect on server results. SonarQube server displays rule violations and no classes seem to be missing there.

Before analysis :

[WARNING] The following dependencies could not be resolved at this point of the build but seem to be part of the reactor:
15:04:52 [WARNING] o com.company.product.plugins:com.company.product.external.libraries:jar:1.0.0-SNAPSHOT (provided)
15:04:52 [WARNING] Try running the build up to the lifecycle phase "package"
15:04:52 [WARNING] The following dependencies could not be resolved at this point of the build but seem to be part of the reactor:
15:04:52 [WARNING] o com.company.product.plugins:com.company.product.capturetool.core:jar:1.0.0-SNAPSHOT (provided)

During analysis :

Class 'com/company/product/core/tools/ocraction/MyClass' is not accessible through the ClassLoader.
    [WARN] [15:05:25.731] Class 'com/company/product/core/tools/ocraction/MyClass' is not accessible through the ClassLoader.

After analysis :

[INFO] com.company.product.core.feature ................ SKIPPED
[INFO] com.company.product.common.feature ... SKIPPED
[INFO] My Product ............................... SKIPPED
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS

I am confused as to why this is happening. I have scoured the internet without answers. I've got responses such as .m2 directory corruption to running "mvn clean package" instead of "mvn clean install" before Sonar analysis.

1 Answer 1

1

I managed to fix this issue. I figured out that Sonar Jenkins plugin does not actually run the command "mvn clean install" by itself. Instead, it merely runs "mvn sonar:sonar" along with any additional arguments.

I executed "mvn clean install" before Sonar's post-build step. This helped to resolve my issue.

1
  • FWIW: It should be enough to execute mvn clean verify instead.
    – msa
    Jun 24, 2021 at 9:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.